1.2正文
1.新建一个example.js文件
代码如下:
var http=require('http');
http.createServer(function(req,res){
res.writeHead(200,{'Content-Type':'text/plain'});
res.end('Hello,World\n');
}).listen(1337,'localhost');
console.log('Server running at http://localhost:1337/');
2.之后在cmd下执行
3.
4.在浏览器中输入http://localhost:1337