const http = require('http');
//创建服务
const server = http.createServer((req, res) => {
//req 请求 服务器获取前端发送的请求内容对象
// res 响应 服务去返回该前端的请求结果对象
//设置返回状态码和数据类型
res.writeHead(200, {'content-type': 'text/html'});
//返回内容
res.end("<h1>hello world</h1>")
});
//设置端口 默认ip
server.listen(3000, () => {
console.log("listening on 3000 port");
});