How to automatically reload Node.js project when using pm2

后端 未结 4 983
情深已故
情深已故 2021-02-02 10:58

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_         


        
4条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-02-02 11:27

    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)

提交回复
热议问题