Installing Express js

First Installing express.js framework globally, use the below command.

It provides API with HTTP utility methods and middleware which in turn helps us create robust applications very easily and helps in faster development.

It doesn’t interfere with the node js features and it provides good performance.

Most of the Node js framework are built on top of express.

npm install -g express
Below screen shot shows the output of above command

install-express-js

Installing express in a project

Use the below command to install express inside a project.

npm install express --save
Below screenshot shows the output of above command.

install-express-js-save

We can see the express is installed inside the node_modules and created a directory for express.

We also need to install body-parser, cookie-parser, multer. These are important modules which need to be installed with express.

  • Body-parser: It is a middleware for handling JSON,raw, text and form data.
  • cookie-parser: It is used to parse Cookie header and populate req.cookies with an object keyed by the cookie names.
  • multer: Middleware for using multipart form data.
npm install body-parser --save 
npm install cookie-parser --save
npm install multer --save
Below screenshot show the output of above command.

body-parser-multer-save

Subscribe Now