From the course: Advanced Node.js: Scaling Applications

Unlock the full course today

Join today to access over 24,800 courses taught by industry experts.

Incorporating a database

Incorporating a database

- [Narrator] Let's exemplify the need for a database to keep data accurate across processes. I'm under the exercise files under chapter two, lesson two. And I'm within the start folder. I already have an app. Let's go ahead and start it by running node app.js. So we can see that we're counting requests. If I come over to the browser and I navigate to locohost 3000 I can see one, two, three. Every time I make a request I see the count go up. If we come over here to the terminal, we can see that this is being handled by one process. A process with the ID of 5465 and it's just incrementing the count for each http request. So I'm gonna go ahead and stop this. And type clear just to save that for me for later. And then I'll come over to the file and check it out. So we can see that we're saving the request in memory here on line three. And on line seven we're incrementing the request and then we are responding with the…

Contents