378 发表于 2017-2-21 11:45:50

Nodejs(1)

首先安装Node到官方网站下载 http://nodejs.org/
安装成功以后继续安装 supervisor
执行以下命令
npm install -g supervisor
如果是linux 或者 Mac 可能会有 权限问题加上 用sudo 安装
写下我的第一个HttpServer
var http = require('http');
http.createServer(function(req, res){
res.writeHead(200,{'Content-type':'text/html'});
res.write('<h1>Node js</h1>');
res.end('<p>My app~</p>');
}).listen(8081);
console.log("Http Server is listening at port 8081.");
页: [1]
查看完整版本: Nodejs(1)