NodeJS Express Package
Package
Express has package manage system like Gem in Ruby.
All packages are written in package.json on your project root.
Example
{ "name": "People", "version": "0.0.0", "private": true, "scripts": { "start": "node ./bin/www" }, "dependencies": { "body-parser": "~1.10.2", "cookie-parser": "~1.3.3", "debug": "~2.1.1", "ejs": "~2.2.3", "express": "~4.11.1", "morgan": "~1.5.1", "serve-favicon": "~2.2.0", "mongoose" : "*", "passport" : "*", "passport-local" : "*", "connect-flash": "*", "bcrypt": "*", "express-session" : "*", "multer" : "*", "app-root-path" : "*", "node-uuid": "*", "aws-sdk": "*" }, "devDependencies": { "grunt": "*" }
We can set package name and version.
If you want to use the current latest version, use *
dependencies are for main project. devDependencies are for development
Install
To install package, type following command on your project root
npm install
All packages are installed in node_modules.
Dependencies of packages are also installed.
Add package
Add package to this file and run following command
npm install
In linux or mac case, there is a case you need sudo