关于Node.js这里不再赘述,直接开始学习
第一步下载安装node.js 此处安装window版本
可以在命令行里查看版本
>node -v
编写第一个hello world
编写js文件helloworld.js,代码如下:
var http = require('http');
http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('Hello World,This is my first node js study!\n');}).listen(1337, "127.0.0.1");
console.log('Server running at http://127.0.0.1:1337/');
使用node运行:
在浏览器访问: