0

I'm working on an app that uses Node.js as the backend. Currently, I have a web server setup like this:

var express = require('express');
var http = require('http');

var app = module.exports.app = express();
http.createServer(app).listen(appConfig.port, function () {
    var logger = app.get('logger');
    logger.info('**** STARTING SERVER ****');
});

My app is working just fine. Except, I have now added a request that is takes ~5 minutes. From my understanding, Node defaults to a 2 minute timeout window. I can read the documentation here. However, I don't understand how to set the timeout to a greater value.

Can someone show me how to increase the timeout to 10 minutes?

0

1 Answer 1

2

this should set it. you need a reference to the server object then set the timeout

var express = require('express');
var http = require('http');

var app = module.exports.app = express();
var server = http.createServer(app);
server.setTimeout(10*60*1000); // 10 * 60 seconds * 1000 msecs
server.listen(appConfig.port, function () {
    var logger = app.get('logger');
    logger.info('**** STARTING SERVER ****');
});
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.