-
-
Save WagnerMatos/dab72734db7d0fe2a4af38d6ecaf8086 to your computer and use it in GitHub Desktop.
Heroku node.js buildpack
This file contains hidden or 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
{ | |
"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"] | |
} |
This file contains hidden or 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
web: node server.js |
This file contains hidden or 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
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