How can I add live-reload to my nodejs server

Rebai Ahmed picture Rebai Ahmed · Aug 10, 2017 · Viewed 40.2k times · Source

This is how can i run my server nodejs. I need to live reload my server when i make changes to the code in the front-end dev

"start": "node server.js"

Answer

Mark Essel picture Mark Essel · Aug 10, 2017

first:

npm install -g nodemon

next add a script line to your package.json

"live": "nodemon server.js" 

now when you npm live it'll live reload

for more details see https://github.com/remy/nodemon

update if live page reload is also needed

npm install -g livereload
livereload . -w 1000 -d

for more details see https://github.com/napcs/node-livereload