node.js - nodejs中如何使用up来重启HTTP服务器?
怪我咯
怪我咯 2017-04-17 16:08:20
0
2
687

up是Guillermo Rauch开发的工具。每次修改服务器端的代码后,为了让通过浏览器访问能够看到修改后的效果,都要手动去重启服务器,而up就是为了以一种安全可靠的方式来解决这个问题。

安装好up后开始使用。

这是一段server.js服务器代码。

module.exports=require('http').createServer(function(req,res){
    res.writeHead(200,{'Content-Type':'text/html'});
    res.end('Hello <b>World</b>');
});

保存好后在终端当前目录下输入命令

up --watch --port 80 server

却 显示

Failed to load configuration.
Execute: `up config` to get started!

输入 up config 后 显示

up-config(1) does not exist, try --help

help命令里似乎也没有找到能有帮助的信息

npm的英文文档看了一遍 感觉应该看懂了但是还是有问题。

怪我咯
怪我咯

走同样的路,发现不同的人生

reply all(2)
刘奇

Thanks for the invitation, I have never used the up you mentioned. I usually use node index.js. If you want to monitor, you can use supervisor.

PHPzhong

I haven’t used up, and I haven’t found it either (up is too common, and it’s hard to find what you want with this keyword).

The error message means that you did not provide a config configuration file, but specifically how to provide it and what the content is, you need to read the documentation or see if there is relevant information in --help.

If you want to monitor code changes, you can use supervisor mentioned by @stardew, or you can use nodemon

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template