Prep repo for Heroku

This commit is contained in:
2017-01-15 23:13:34 -08:00
parent 4b7a94f490
commit 053fbfd90b
2 changed files with 12 additions and 3 deletions

View File

@@ -2,9 +2,17 @@ var express = require('express');
// Create our app
var app = express();
const PORT = process.env.PORT || 3000;
app.use(function (req, res, next) {
if (req.headers['x-forwarded-proto'] === 'http') {
next();
} else {
res.redirect('http://' + req.hostname + req.url);
}
});
app.use(express.static('public'));
app.listen(3000, function () {
console.log('Express server is up on port 3000');
app.listen(PORT, function () {
console.log('Express server is up on port ' + PORT);
});