Skip to content

Instantly share code, notes, and snippets.

@andreialecu
Last active December 7, 2015 14:07
Show Gist options
  • Save andreialecu/a563c9a5ab7fdd7dc02f to your computer and use it in GitHub Desktop.
Save andreialecu/a563c9a5ab7fdd7dc02f to your computer and use it in GitHub Desktop.
deployd heroku
// require deployd
var deployd = require('deployd');
// configure database etc.
var server = deployd({
port: process.env.PORT || 1337,
env: 'production',
db: { connectionString: process.env.MONGO_URL }
});
// start the server
server.listen();
// debug
server.on('listening', function() {
console.log("Server is listening on port: " + (process.env.PORT || 1337));
});
// Deployd requires this
server.on('error', function(err) {
console.error(err);
process.nextTick(function() { // Give the server a chance to return an error
process.exit();
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment