【文件属性】:
文件名称:NodeJS创建最简单的HTTP服务器
文件大小:183KB
文件格式:PDF
更新时间:2021-01-20 04:02:05
http请求 node od
☆ 引子
var http = require('http');
http.createServer(function(request, response){
response.writeHead(200, { 'Content-Type': 'text-plain' });
response.end('Hello World\n');
}).listen(8124);
对这个http这个最顶层的对象有个.createServer服务器的方法。
创建了一个服务器,跟服务器相关的就两个事件。
请求事件,request事件,request对象。
响应事件,response事件,r