How to install express.js in a node project? 1


To install express.js in a node project, check the node & npm version first by the following code:

 

npm -v

node -v

 

If node & npm is already installed, then write the following command in the terminal to install express:

 

 

npm install --save express

or

npm i express

 

 

Now include the following code in project_folder/index.js:

 

 

const express = require('express');

const app = express();

 

 

Hope it helped!