Skip to content

Commit d4385f2

Browse files
committed
Heroku setup
1 parent 3ab4e68 commit d4385f2

File tree

4 files changed

+409
-1231
lines changed

4 files changed

+409
-1231
lines changed

Procfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
web: node app.js

app.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
const express = require('express');
2+
const path = require('path');
3+
const app = express();
4+
5+
const forceSSL = function() {
6+
return function (req, res, next) {
7+
if (req.headers['x-forwarded-proto'] !== 'https') {
8+
return res.redirect(
9+
['https://', req.get('Host'), req.url].join('')
10+
);
11+
}
12+
next();
13+
}
14+
}
15+
16+
app.use(express.static(__dirname + '/dist'));
17+
18+
app.get('/*', function(req, res) {
19+
res.sendFile(path.join(__dirname + 'dist/index.html'));
20+
});
21+
22+
app.listen(process.env.PORT || 8080);
23+
app.use(forceSSL());

0 commit comments

Comments
 (0)