the method of automatic restart is provided upstairs, so I won't say much about it. In fact, there is no need to restart, just do not exit, the specific way is to catch "uncaught exceptions":
process.on('uncaughtException', err => {
console.error(err && err.stack)
});
pm2, forever and other process managers learn about
debug nodemon locally, and automatically restart
by modifying the code.
pm2 is recommended for management.
https://www.jianshu.com/p/f64...
you can learn about forever, which is very useful. After installation, start your project with forever to solve the problem
nodemon is recommended in the development phase
introduction to Nodemon
pm2 is recommended in the production phase
introduction to pm2
you can use pm2 or forever in the test phase
introduction to forever
the best toy ndb
gtihub: https://github.com/GoogleChro...
advantages:
- the error process does not crash
- code is updated automatically, similar to nodemon and pm2, but officially this uses no restart technology
The - code is updated bidirectionally. After modification in the debugger, the source file is also modified
- comes with a terminal
- refresh the environment with one click, just like a browser refresh
figure:
linux, Mac development environment:
- daemon tools such as supervisor and nodemon, which can be used to debug
- pm2 process monitoring tool, which can be used to publish projects