Skip to content

Instantly share code, notes, and snippets.



Last active Aug 28, 2015
What would you like to do?
Setting ExpressJS server timeout using best practices
var express = require('express'),
http = require('http'),
app = express();
var server = http.createServer(app);
var timeout = 0;
server.setTimeout(timeout, function() {
server.listen(app.get('port'), function() {
console.log("Express server listening on port %d in %s mode", app.get('port'), app.get('env'));

This comment has been minimized.

Copy link

@gnz00 gnz00 commented Aug 28, 2015

What's the best practice for getting this to stay alive. Execution finishes before the server.listen process gets kicked off.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment