Installing Express
Up until now, we used npm
to directly install external modules for our Node application. You could, of course, use this approach and install Express by typing the following command:
$ npm install express
But, directly installing modules isn't really scalable. Think about it for a second: you're going to use many Node modules in your application, transfer it between working environments, and probably share it with other developers. So, installing the project modules this way will soon become a dreadful task. Instead, you should start using the package.json
file that organizes your project metadata and helps you manage your application dependencies. Begin by creating a new working folder and a new package.json
file inside it, which contains the following code snippet:
{ "name" : "MEAN", "version" : "0.0.3", "dependencies" : { "express" : "~4.8.8" } }
In the package.json
file, note that...