Express.js Response Timeout
There is already a Connect Middleware for Timeout support: var timeout = express.timeout // express v3 and below var timeout = require(‘connect-timeout’); //express v4 app.use(timeout(120000)); app.use(haltOnTimedout); function haltOnTimedout(req, res, next){ if (!req.timedout) next(); } If you plan on using the Timeout middleware as a top-level middleware like above, the haltOnTimedOut middleware needs to be the … Read more