nodejs--hello word
开始一个简单的程序,hello world:
var http = require("http"); http.createServer(function(request, response) { response.writeHead(200, {"Content-Type" : 'text/plain'}); response.end("Hello world\n"); }).listen(8888); console.log("Server running at http://localhost:8888");
保存为hello_world.js,使用node执行一下该文件。
$ node hello_word.js Server running at http://localhost:8888
在浏览器输入http://localhost:8888请求,页面输出:
Hello world
浙公网安备 33010602011771号