I want to create a simple Node.js server and send data with pipe() method. But I have an issue.
The page loads when server started the first time, but when I refresh the page, it becomes blank. I mean the data is not loaded. Why does it happen?
var http = require('http'),
fs = require('fs');
var myReadStream = fs.createReadStream(__dirname + '/input.txt', 'utf8');
http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
myReadStream.pipe(res);
}).listen(3300);