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