0

I'm generating a huge .docx document in a rest-api call. It takes several minutes for it to complete. Problem is the server somehow sends a "timeout" after a minute or so. Is there anyway to increase this time? Is it a browser thing or can I change it in express?

exports.generateDoc = function(req, res){
  var file = generateDoc(); //This takes several minutes
  res.setHeader('Content-disposition', 'attachment; filename=output.docx');
  res.end(file,'binary');
}
Joe
  • 4,274
  • 32
  • 95
  • 175
  • Most likely browser dependent. Check out [this answer](http://stackoverflow.com/questions/5798707/browser-timeouts). – Brennan Jun 17 '15 at 15:38

1 Answers1

0

You can set the timeout of an HTTP server in Node using the server.setTimeout() method which is described in the Node docs here.

There's also the Express middlewhere timeout which may help with Express.

Aweary
  • 2,302
  • 17
  • 26