koa-timeout
Timeout middleware for koa.
Will throw "Request timeout" (Http 408) for any requests that take too long.
Installation
$ npm install koa-timeout
Example
If we always want to respond within half a second, we could use timeout(500)
as middleware after our error handler:
var koa = ;var timeout = 500; var app = ;app; app; // Some potentially slow logic:app; app;
License
MIT