express-stream
express-stream copied to clipboard
Browser hangs if pug templates are used
Have you checked with pug, I think there may be some problem when using res.end() and the response is not flushed with the last chunk, the browser hangs for a long time without any error and the last chunk is not sent to the browser.
This is my code
stream.useAllAutoTags(true);
stream.streamBefore('_header');
stream.streamAfter('_footer');
app.get('/', stream.stream(), (req,res) => {
res.stream('index');
res.end
});
I haven't touched this project in years, so I'm not as familiar as I once was. That said, I did notice a difference between your code snippet and the readme. You may need to update your code snippet by replacing res.end with res.close();.
I am afraid that won't work due to the res.close method not available anymore
Related to #11
Oh thanks, you're right. I did notice that your code snippet doesn't call res.end as a function. Can you double check that you're calling res.end(); with parenthesis?