Automatically Restart Your Node.js Application

Many of us write code on Node.js, click [CTRL+S] to save the file but forget to restart the application.

If we don't forget to restart the application we will go in console and hit [CTRL+C] to stop the application and then restart it by pressing the [UP] arrow and [Enter].

Nodemon

You can automate this repetitive task and make your development process easier by using nodemon.

nodemon will watch the files and if any files were changed, the nodemon will automatically restart your node application.

First, you need to install nodemon:
[crayon-5b5589159ecf1900156579/]
Now, you should swap the node command for the nodemon command:
[crayon-5b5589159ecff766271512/]

Read about: How to set up a Node.Js development environment

If you need to manually restart your application, instead of stopping and restart nodemon, you can simply type rs on your console.
[crayon-5b5589159ed07422889980/]
Happy Coding!