Building an Express Application Chapter 2
Now, let's restart our node server for the app with:
$ node app.js
With this, when we visit http://localhost:3000/users, we will be able to see the
following:
We have successfully set up a controllers and views part of the MVC architecture. We
will cover more on models part in further sections.
In the previous chapter, we talked about GitHub and how to use it for
making code history by making small commits. Don't forget to set up a
repo and continuously push code to GitHub.
The npm packages are stored in the node_modules directory, which we should not push to
GitHub. To ignore such files, we can add a file called .gitignore and specify the files we
do not want to push to GitHub.
Let's create a file within our application as well, called .gitignore, and add the following
content:
node_modules/
This way, when we install any packages, it will not show up as the code difference while
making commits to GitHub.
We are having to restart our node server every time we make some changes to our code
which is very time-consuming. To ease this process, node provides a package called
nodemon, which automatically restarts the server every time we make changes to the code.
To install the package, run:
$ npm install nodemon --save