Node是基於chrome v8 engine,可使用js編寫服務器端代碼的平臺。
Node.js is a platform built on Chrome's JavaScript runtime for easily building fast, scalable network applications. Node.js uses an event-driven, non-blocking I/O model that makes it lightweight and efficient, perfect for data-intensive real-time applications that run across distributed devices.
特點
無阻塞
事件驅動
輕量級
js編寫可直接運行的代碼程序
速度快
使用場景
微博、網聊
文件上傳下載服務器
ad 系統
學習地址
視頻地址:
http://node.codeschool.com/levels/1
官網:
代碼
在命令行執行時“node 文件名稱”,httpHello可通過瀏覽器打開。
hello.js
var sys=require("sys");
sys.puts("hello world");
httphello.js
var http=require('http');
http.createServer(function (request,response){
response.writeHead(200);
response.write("hello world");
response.end();
}).listen(8080);
console.log("server ib port 8080");