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].


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:
Now, you should swap the node command for the nodemon command:

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.
Happy Coding!