How to make node auto restart while development

Views: 171   

Node process need to be restarted when ever you make changes to the *.js files.
But you can automate this annoying job using nodemon Following are the steps to setup nodemon

  • Install nodemon globally, so that you can use this for any of your node projects
    npm install -g nodemon
    
  • Now instead starting your node process with node index.js use nodemon, like below
    nodemon index.js
    

Some additional information

nodemon originally written to restart hanging processes. You can use it in your production too. But PM2 is more matured in that space.

On By