Skip to content

Instantly share code, notes, and snippets.

@david-meza
Created January 4, 2016 04:38
Show Gist options
  • Save david-meza/b4c719e03c70d1a29826 to your computer and use it in GitHub Desktop.
Save david-meza/b4c719e03c70d1a29826 to your computer and use it in GitHub Desktop.
Heroku node.js buildpack
{
"name": "AppName",
"version": "0.0.0",
"private": false,
"author": "your-name",
"devDependencies": {
},
"engines": {
"node": "5.1.0",
"npm": "3.4.1"
},
"scripts": {
"test": "grunt test",
"postinstall": "bower install"
},
"dependencies": {
"bower": "1.7.1",
"express": "4.13.3"
},
"cacheDirectories": ["node_modules"]
}
web: node server.js
var express = require('express');
var app = express();
// set the port of our application
// process.env.PORT lets the port be set by Heroku
var port = process.env.PORT || 8080;
// make express look in the public directory for assets (css/js/img)
app.use(express.static(__dirname + '/app'));
// set the home page route
app.get('/', function(req, res) {
// make sure index is in the right directory. In this case /app/index.html
res.render('index');
});
app.listen(port, function() {
console.log('Our app is running on http://localhost:' + port);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment