The server created by Node.js automatically restarts after modifying the code

Problem Description

How to automatically restart the server created with Node.js after modifying the code?


Solution

Use a third-party tool nodemonto help us solve the problem frequently modify the code to restart the server

nodemonIt is a third-party command line tool developed based on Node.js, we need to install it separately when we use it

  • npm install nodemon -g Global installation
  • Use to nodemon -vview the version of nodemon
  • After the installation is complete, use nodemon xxx.jsStart. As long as nodemon xxx.jsthe server is started, it will monitor file changes, and when the file changes, it will automatically restart the server.

Further reading

https://blog.csdn.net/weixin_43974265/category_10692693.html

Guess you like

Origin blog.csdn.net/weixin_43974265/article/details/111936015