|
http://www.nodebeginner.org/index-zh-cn.html
这个不错
在windows下就可以运行
http://nodejs.org/
目前稳定版0.6.13
建个helloworld.js
console.log("Hello World");
node helloworld.js运行
如果跑http请求
console.log("Hello World");
var http = require("http");
http.createServer(function(request, response) {
response.writeHead(200, {"Content-Type": "text/plain"});
response.write("Hello World");
response.end();
}).listen(8888);
node helloworld.js
后,在http://localhost:8888/
可以看到效果
console.log("Hello World");
//-------------
var http = require("http");
http.createServer(function(request, response) {
response.writeHead(200, {"Content-Type": "text/plain"});
response.write("Hello World");
response.end();
}).listen(8888);
//-------------
function say(word) {
console.log(word);
}
function execute(someFunction, value) {
someFunction(value);
}
execute(say, "Hello");
//---------
function execute(someFunction, value) {
someFunction(value);
}
execute(function(word){ console.log(word) }, "Hello");
//var http = require("http");
//
//function onRequest(request, response) {
// response.writeHead(200, {"Content-Type": "text/plain"});
// response.write("Hello World");
// response.end();
//}
//
//http.createServer(onRequest).listen(8888); |
|
|