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);
网友评论