tareq3
11/21/2018 - 3:56 PM

npm command

The basic command for npm

Npm Express libs:

1. Express (Framework)

2. Bodyparser (middleware)

3. cors ( for giving access from any client)

4. morgan (for logging on console about calls)

5.jsonwebtoken ( for creating auth Bearer token)

6.bcryptjs ( for password hashing)[npm i bcrypt-nodejs --save]

Npm Mysql lib:

1. mysql2

Delete all nodemodlues and install again following dependencies

rm -rf node_modules && npm install

Npm Commands:

For Initializing a Package:

npm init

For install a lib into a local project:

npm install libName(just install no dependecies in package.json)
                        
                        npm install --save libName(install and add dependencies in package.json)

For install a lib as dev dependencies

npm install --save-dev libName(dev dependencies will be used only in developing preiod, not in publish product)

For Global dependencies which is not only for a project for the whole npm system.

npm install -g libName 

Note: can use shorter format like:

npm i projectName 

For Start a npm server(express):

npm start

For Close server OR stop npm command:

cntl+c

Uninstall a package:

npm un <packageName>

List installed packages:

npm list —depth=0

View outdated packages:

npm outdated

Update packages:

npm update 

- To install/uninstall packages globally, use -g flag.

For es6 thread :

/*jshint esversion: 6 */