一大早看到微博上有大牛说node官方发布了Windows版的nodejs,赶紧抓下来看看,虽然是unstable版本的,但起码向Windows走来,必定会推动node的发展,太好了。
1、下载node.exe放到任意目录,假设E: odejs
2、在E: odejs下新建helloworld.js,输入以下内容,保存关闭
var http = require('http');
http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('Hello World
');
}).listen(1337, "127.0.0.1");
console.log('Server running at http://127.0.0.1:1337/');
3、运行cmd,cd到E: odejs下,输入:node helloworld.js
ps:您也可以直接将helloworld.js拖放到node.exe上运行
4、打开ie,运行http://127.0.0.1:1337/
恩,收工。简单吧,其实这是官网的demo,更多例子参考官方文档吧。
项目主页:http://nodejs.org/
windows版地址:http://nodejs.org/dist/v0.5.1/node.exe
loading