server.js
var http = require("http");
http.createServer(function(request,response){
//发送http头部
//http状态 : 200 :ok
//内容类型:text/plain
response.writeHead(200,{'Content-Type':'text/plain'});
//发送响应数据“hello world”
response.end('Hello world!')
}).listen(8888)
console.log('server running at http://127.0.0.1:8888')
运行nodejs 程序
在对应的程序路径下面 运行nodejs 程序 :node ‘程序名称’
效果: