This is an example in the book : "Professional Node.js". It should output a timestamps every second for 3s. But nothings appear before the res.end() is called : (the page load while the 3s, before all appears on the screen...)
require('http').createServer(function (req, res) {
res.writeHead(200, { 'Content-Type': 'text/plain' });
var left = 3;
var interval = setInterval(function () {
res.write(Date.now() + " ");
left -= 1;
if (left === 0) {
clearInterval(interval);
res.end();
}
}, 1000);
}).listen(4000);
Is it the same with you ?
[Edit:] I find this Simple Node.js server which responds in chunked transfer encoding and it doesn't work for me either... (all is display after the end() call ~5s)