I am currently programming Node.js with Express.js, and every time I change a line of code in the file router or app, I need to type the command:
pm2 reload id_
By default, node doesn’t automatically refresh our server every time we change files. I don't know about specific pm2 solution, but you can do that with nodemon. Just install with: npm install -g nodemon
and use with: nodemon server.js
.
Personally, it looks like @rogier-spieker answer should get the accepted answer. (I can't even delete this answer as long as it is the accepted answer)