Skip to content

Instantly share code, notes, and snippets.

@L8D L8D/app.js

Last active Aug 28, 2015
Embed
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'));
});
});
@gnz00

This comment has been minimized.

Copy link

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
You can’t perform that action at this time.