[英]Watch command for Node.js HTTP Server
I am using express and every time I make a change to my controller, I need to restart the HTTP server, which is somewhat inconvenient. 我正在使用express,每次我对控制器进行更改时,我都需要重新启动HTTP服务器,这有点不方便。 Is there a "watch" command or an equivalent in express or Node.js that watches for changes and restarts the server automatically? 在express或Node.js中是否有“watch”命令或等效命令可以监视更改并自动重新启动服务器?
尝试nodemon ,每次进行更改时都会重新启动应用程序
To watch files for changes, you could use fs.watch()
or fs.watchFile()
. 要观察文件的更改,可以使用fs.watch()
或fs.watchFile()
。 However, daemon modules such as supervisor or nodemon exist for your purpose. 但是,出于您的目的,存在诸如supervisor或nodemon之类的守护程序模块。
我使用node-dev在源代码更改时自动重启。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.