Learn how to restart a node server automatically using nodemon. In this tutorial, you see while we are developing our nodejs app, When you change something in your code you have to start the server to see it again, that is, every time we change the code, we often have to start the server.

To avoid this we use Nodemon. Nodemon is a CLI (command line) resource that can wrap your NodeJS application. how to use Nodemon It can view files in your server folder and automatically restart your application when changes are received.

Global installation 

You can install it locally for just current application or even install it globally for all of your Node Projects.

npm install nodemon -g

What is the benefit of installing Nodemon locally? It arrives in the developer's project by a command in the package.json

Local Install

npm install nodemon --save-dev

Getting started

Nodemon can handle the same agrrument that were transferred to the Node script to restart the node server. If your node.js or express setup is in server.js or index.js file, start your application as you would with the first node application.

Just like using your script with the Node method of restarting the app, you can transfer arguments at the end.

nodemon server.js