node.js安装应用手记

//1.下载安装node
//下载地址:http://nodejs.cn/download/
//下载地址:https://nodejs.org/en/download/
//------------

//2.写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, '127.0.0.1');
console.log('Node Server running at http://127.0.0.1:1337');

//-------------
//3.在命令行执行:node example.js,看到如下结果:
//Node Server running at http://127.0.0.1:1337

//4.在浏览器打开地址:http://127.0.0.1:1337,
//看到输出 Hello World
//恭喜node安装成功!

 

posted @ 2017-09-10 10:26  SummerSoft  阅读(138)  评论(0编辑  收藏  举报