Building Rest API with Node JS is very easy nowadays with the modular tools such as Express.js
<aside> 💡 Pre-request → Basic knowledge of Java Script and Node with NPM!
</aside>
At first we’ll initialize the node project and then we’ll install Express.js
and nodemon
. Furthermore if I talk about nodemon
is nothing but a command line tool for Node JS which keeps monitoring you project and hot reload it when required!
Express.js
is a minimal and flexible web server for Node JS, Express.js
is widely used web server and is very robust in production build also!
Enter this command into and shell terminal or CMD!
npm init -y
Then,
npm i -g nodemon
Let’s install Express web server now
npm i express
server.js
fileOpen any code editor in the desired directory where you initialized node app and installed express. Then create a file namely server.js
and open it!