A guide to create a server in Node.js using Express Js.
Edit index.js file with the code:
const express = require('express);
const app = express();
app.get('/', function(req, res){
res.send('Hello Node');
})
app.listen(3000);
The above code is the simplest code to start a server using expressJs in NodeJs. However, the module express is third party module that need to be install before importing in project. To download express type a single line code
//Choose one
npm install express
npm i express
//specify version
npm i express@4.18.2
//install globally on device
// no need to install in each project
// once installed globally
npm install express -g