HelloNode
新建HelloNode.js文件,输入:
var http = require("http");
http.createServer(function(request, response){
response.writeHead(200, {"Content-Type": "text/plain"});
response.end("hello node.js");
}).listen(3000);
console.log('http://127.0.0.1:3000/');
保存后,进入命令行窗口,执行:node HelloNode.js
打开浏览器,输入:http://127.0.0.1:3000,如图所示: