My route return only html as text , instead of getting the .gz file and providing it as javascript or css:
router.get('/', function (req, res, next) {
try {
res.setHeader('Content-Type', 'text/event-stream')
res.setHeader('Cache-Control', 'no-cache')
// send a ping approx every 2 seconds
var timer = setInterval(function () {
res.write('data: ping\n\n')
// !!! this is the important part
res.flush()
}, 2000)
res.on('close', function () {
clearInterval(timer)
})
res.render('index', mergedData.globals);
}
catch (err) {
res.render('error', {message: clientData.globals.globalErrorMessage});
//debug.log ?
}
});