What is the current options available for reload in Node JS?

What are the current available options to reload the files in node js web application development – with or without restarting – i.e both

Couple of links are out-dated now

1. https://stackoverflow.com/questions/2925940/how-can-i-edit-on-my-server-files-without-
   restarting-nodejs-when-i-want-to-see-t
2. https://github.com/petruisfan/node-supervisor
3. https://github.com/kriszyp/nodules

Please advise

Thanks

>Solution :

  1. Nodemon
npm install -g nodemon
# or
npm install --save-dev nodemon

nodemon your-app.js

Nodemon will watch for file changes and restart the server as needed.

2.pm2

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

The –watch flag tells PM2 to watch for file changes.

Leave a Reply