expressjs / timeout

Request timeout middleware for Connect/Express

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Documentation Update

sachi-pen opened this issue · comments

For easier understanding, kindly add to documentation that this middleware does not override the server's default timeout.

In case of the setting timeouts greater than the default of 120000 ms, the usage shall be as below

var express = require('express')
var timeout = require('connect-timeout')

var app = express();

let SERVER_TIMEOUT = 300000;
app.use(timeout((SERVER_TIMEOUT/1000)+"s"))

//Routers here
let server = app.listen(3000);
server.timeout = SERVER_TIMEOUT;

(or)

other better examples.

It could just save a lot of time for the beginners.

Hi! Thanks for the feedback. Writing good doximentation is hard, especially when the person writing it takes their own knowledge for granted and it becomes blinders, not even realizing there is something a prospective user may not know. Sorry for the pain you went though. I'm not sure how to make it better, but maybe would you be willing to make a pull request with your thoughts on the changes that would have helped you through the journey you had?

In that case why is it also necessary to set "server.timeout"?

In that case why is it also necessary to set "server.timeout"?

node.js default (http) server timeout is 120 sec. Requests would hit this limit before connect-timeout's limit.

PR #30 was closed (Link for extra context), same for this issue.