node 版本0.6.2
OS:ubuntu 10.04
一个使用Node写的只有"Hello World"返回的web 服务器
var http = require('http');
http.createServer(function (request, response) {
response.writeHead(200, {'Content-Type': 'text/plain'});
response.end('Hello World\n');
}).listen(8124);
console.log('Server running at http://127.0.0.1:8124/');
将上述代码保存到example.js中,并在控制台执行如下命令
> node example.js
控制台将打印日志
Server running at http://127.0.0.1:8124/
本文介绍如何使用Node.js编写一个简单的web服务器,该服务器仅返回'Hello World'。
1447

被折叠的 条评论
为什么被折叠?



