Auto restart NodeJS app when file and code change

2016-02-20 08:17:09 -0500

To automatically detect file changes and restart the app you will need a process manager to start your NodeJS app

Note: Do auto restart only on your dev deployment. Never do it in production

Option 1: pm2

npm install pm2 -g
pm2 start app.js --watch

You can also use pm2 to start non-nodejs app

pm2 start --interpreter python

Option 2: nodemon

npm install -g nodemon
nodemon app.js

You can also use nodemon to start non-nodejs app. e.g. starting a python app:

nodemon --exec "python -v" ./
«Newer      Older»

Back to home

Subscribe | Register | Login | N