~~~
//引入http模块
const http = require('http');
const url = require('url');
//创建服务
const server = http.createServer(function(req,res){
console.log(req.url);
const.log(url.parse(req.url,true));
})
//监听端口号
server.listen(8000,function(){
console.log('server is created,listening on 8000 port');
})
~~~
## Http.createServer
http.createServer(requestListener),它返回一个http.server的实例。
requestListener自动被添加到request事件中。