3 thoughts on “What is the default timeout of a req in express?

  1. @flickz @vitoravale I’ve found two ways to make it work.

    You may set the timeout either globally for entire server:

    var server = app.listen();
    server.setTimeout(500000);

    or just for specific route:

    app.post('/xxx', function (req, res) {
       req.setTimeout(500000);
    });

    IMHO the second sounds much proper 🙂

  2. Figured it out, it was a typo 😓
    It should be res, instead of req

    res.setTimeout(3000, function () {
        console.log('here')
      });
    

Comments are closed.