What is the best way to manage Express timouts in 2019?

47 Views Asked by At

Running into a situation where requests are crashing on Heroku before as Node process exits, leaving that Node process orphaned — and delivering an ugly Heroku error message.

What I think needs happens is: Express needs a timeout set, and once reached, stops any process in flight (and handles the timeout in a graceful way — sending an error message to user).

https://www.npmjs.com/package/connect-timeout

I'm looking at connect-timeout and it seems a little awkward to sandwich in a haltOnTimedout after every middleware. Is there some other (better) way to manage timeouts in Express or this the best way?

0

There are 0 best solutions below