I'm building my first NodeJs app, and I was hoping that the browser would update whenever I hit Control+S on my app.js file. For example, initially I have it outputting Hello world, then I do node app.js, visit http://localhost:3000 in my browser. If I go back to editing app.js and update it to be Hello world2, I have to cancel node via Control+C, then node app.js to see my updates. Not even doing F5 in my browser will get the latest changes.
You can use Nodemon to auto-restart your server when files are changed
Install:
npm install -g nodemon
Run:
nodemon ./server.js localhost 3000
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With