标签:style http io ar sp 文件 on log cti
安装好nodejs之后
在命令行中直接运行:
node -v
var http = require(‘http‘);
http.createServer(function (req, res) {
res.writeHead(200, {‘Content-Type‘: ‘text/plain‘});
res.end(‘Hello World~~\n‘);
}).listen(1337, "127.0.0.1");
console.log(‘Server running at http://127.0.0.1:1337/‘);
存为一个js文件:example.js
node example.js //显示Server running at http://127.0.0.1:1337/
浏览器输入http://127.0.0.1:1337 //显示 Hello World~~
标签:style http io ar sp 文件 on log cti
原文地址:http://www.cnblogs.com/liujin0505/p/4049630.html