關於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運行:
在瀏覽器訪問: