简体   繁体   English

node.js:更新应用程序而无需停止并再次运行

[英]node.js: Updating an app without the need to stop and run again

I've started playing with node.js and express.js and wrote an hello-world app following the docs: 我已经开始使用node.js和express.js并在文档之后编写了一个hello-world应用程序:

app.get('/hello', function(req, res){
  res.send('Hello World');
});

If I change the code and refresh the browser - nothing happens. 如果更改代码并刷新浏览器,则不会发生任何事情。
I have to stop the server and run it again. 我必须停止服务器并再次运行它。

Is there a solution for that? 有解决方案吗?

Yes, you do have to stop it and start it again. 是的,您必须停止它并重新启动它。

There are apps that do this automatically for you. 有些应用会自动为您执行此操作。 Check out nodemon for example: https://github.com/remy/nodemon 例如,请查看nodemon: https : //github.com/remy/nodemon

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM