PHP经验分享

node基本概念及运行规则

2016-09-10  本文已影响23人  野原浩二

Nodejs概念:

nodejs是运行javascript的编译环境。

创建一个http服务:

const http = require('http');
const ip = '172.17.166.93';
const port = 3000;
var a = function (req, res){
res.writeHead(200,{'content-type':'text/html'});
res.write("<h1>*********</h1>");
res.end('**********');
}
var server = http.createServer(a);
var c =function(){
console.log("server is running");
}
server.listen(port,ip,c);

上一篇 下一篇

猜你喜欢

热点阅读