Last active
December 7, 2015 14:07
-
-
Save andreialecu/a563c9a5ab7fdd7dc02f to your computer and use it in GitHub Desktop.
deployd heroku
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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