var http = require("http"); http.createServer(function(request, response) { response.writeHead(200, {"Content-Type": "text/plain"}); response.write("test nodjs"); response.end(); }).listen(8899); console.log("nodejs start listen 8899 port!");
打开命令窗口,输入node D:\sunyj\test.js 会看到如下窗口:
原文:http://www.cnblogs.com/sunyj/p/4920974.html