一,supervisor
1,介绍
nodejs下supervisor的介绍。
A little supervisor script for nodejs. It runs your program, and watches for code changes, so you can have hot-code reloading-ish behavior, without worrying about memory leaks and making sure you clean up all the inter-module references, and without a whole new require system.
意思是支持代码的热部署,如果修改代码,不需要每次都关掉程序,重新部署。
附上链接:https://www.npmjs.com/package/supervisor
2,安装
npm install supervisor -g
-g是全局安装的意思,需要管理员权限。如果不加-g则意味着在当前用户的当前目录下安装。
3,演示
var http = require("http");
var server = http.createServer(function(req,res){
res.end("hello world")
});
server.listen(3000);
在终端输入node app.js
浏览器输入localhost:3000会显示hello world。然后在终端输入supervisor app.js
以及输入node app.js
。修改代码。
var http = require("http");
var server = http.createServer(function(req,res){
res.end("hello world!!!")
});
server.listen(3000);
这时在网页上就会显示hello world!!!。
2,iron-nodejs
nodejs调试。