0
所以我有下面的代码 -node.js - 立即结束请求?
var http = require('http');
http.createServer(function (req, res) {
console.log("Connected!");
res.writeHead(200);
req.on('data', function(data) {
res.write(data);
});
}).listen(5000);
但是,当我写了Chrome localhost:5000
它只是加载网页,然后它说,服务器没有发送的任何数据..
我想通如果我在数据事件之后编写req.end();
,它会完美地加载页面。
但是,我不想立即结束请求。
我该怎么办?
谢谢你,这就是我搜索了! – Israelg99 2013-02-14 03:19:33