非常教程

Node.js教程

Node.js 官方文档

Node.js 示例

Node.js示例

第一个服务器的例子就从 “Hello World” 开始:

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程序执行:

> node example.js
Server running at http://127.0.0.1:8124/

在该Node.js官方文档中的所有的例子都可以使用上述方法执行。

Node.js

Node.js是一个基于Chrome JavaScript运行时建立的平台, 用于方便地搭建响应速度快、易于扩展的网络应用。Node.js 使用事件驱动,非阻塞I/O 模型而得以轻量和高效,非常适合在分布式设备上运行数据密集型的实时应用。

主页 https://nodejs.org/en/
源码 https://github.com/nodejs/node