Skip to content

Instantly share code, notes, and snippets.

@alkema
Created June 15, 2011 17:36
Show Gist options
  • Save alkema/1027622 to your computer and use it in GitHub Desktop.
Save alkema/1027622 to your computer and use it in GitHub Desktop.
make express app testable
// Only listen on $ node app.js <PORT> so we can test this code
if (!module.parent) {
var port = process.argv[2] || 8081
app.listen(port);
console.log("Express server listening on port %d", app.address().port);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment