Previously, we have already covered what exactly node.js is and the reason for which we need them. We have also learned how it came into existence. In this article, hoping that you have already installed node.js, we will create a directory for holding the application and make that a working directory. Exciting, right!!? So without wasting any time, let’s get started.
$ mkdir myapp
$ cd myapp
In the next step, we need to use the package.json package file for the application. If you need more information about the working of package.json, you can visit here.
|$ npm init
This command gives rise to several things, like the name and version of the application. For the time being, we can use now RETURN to accept defaults for most of them, with the following exception:
|entry point: (index.js)
Choose and enter the name of the main file. You can even name it app.js. But, if you need the previous name index.js, just click on return to backtrack to the default value.
In the following steps, we need to install the Express in the myapp directory and save it for the dependencies list.
|$ npm install express --save
For installing Express temporarily, for the time being, we can also use:
|$ npm install express --no-save