(i) Create folder Express
(ii) Open Terminal and type npm init -y
Now,
package.json
file created on your folder.
(iii) Now create js file index.js
(iv) Now we want to install express, Open Terminal and type npm install express
(v) Now setup of your express is ready to work.
(vi) After enter the code, You want to start the server, by giving command,
- Open Terminal and type,
npm install nodemon
for install nodemon for autosave purpose. - Add
"start" : "nodemon index.js"
on yourpackage.json
file under"scripts"
- Now type,
npm run start
on your terminal to start the server with the port. - Now Open browser and type
localhost:2000/hi
and hitEnter
button to test the data.