Skip to content

Instantly share code, notes, and snippets.

@Darex1991
Forked from facultymatt/Procfile
Created January 1, 2016 18:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Darex1991/58fe5f05d4f40587e2ec to your computer and use it in GitHub Desktop.
Save Darex1991/58fe5f05d4f40587e2ec to your computer and use it in GitHub Desktop.
Get Deployd running on Heroku!
{
"name": "app_name",
"version": "0.0.1",
"description": "Super awesome app",
"keywords": [],
"homepage": "",
"author": "You!",
"contributors": [],
"dependencies": {
"deployd": ">= 0"
},
"scripts": {
"start": "node server"
},
"engines": {
"node": "0.8.x",
"npm": "1.2.x"
},
"license": "MIT"
}
web: node server
// require deployd
var deployd = require('deployd');
// configure database etc.
var server = deployd({
port: process.env.PORT || 5000,
env: 'production',
db: {
host: 'something.mongolab.com',
port: 27857,
name: 'database_name',
credentials: {
username: 'username',
password: 'password'
}
}
});
// heroku requires these settings for sockets to work
server.sockets.manager.settings.transports = ["xhr-polling"];
// start the server
server.listen();
// debug
server.on('listening', function() {
console.log("Server is listening on port: " + process.env.PORT);
});
// 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