日期:2014-05-16 浏览次数:20682 次
这里面提供的是在不同操作系统上编译node.js的方法,参照链接https://github.com/joyent/node/wiki/Installation
http://nodejs.org/download/
         我的机器是windows的,选择的文件是,是编译后的版本:Windows Installer (.msi)  32-bit



编写 helloworld.js 代码如下:
var http = require('http');  
server = http.createServer(function (req, res) {  
      res.writeHeader(200, {"Content-Type": "text/plain"});  
      res.end("Hello World\n");  
})  
server.listen(8000);  
console.log("httpd start @8000");  
运行 node helloworld.js按照上面node.js cmd的方法,控制台显示 httpd start @8000
打开浏览器访问 http://localhost:8000/ 浏览器显示 Hello World