-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathapp.js
More file actions
27 lines (22 loc) · 768 Bytes
/
app.js
File metadata and controls
27 lines (22 loc) · 768 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
'use-strict';
const express = require(`express`);
const app = express();
const exportDir = `export`;
app.use(express.static(__dirname));
app.use(express.static(exportDir));
// this is the old landing page (still showing up in google results)
// for a smoother UX it gets redirected immediately without an error page
app.get(`/documentation/get-started`, (req, res) => {
res.redirect(301, `/documentation/install-dist`);
});
app.get(`*`, function (req, res) {
const protocol = req.get(`X-Forwarded-Proto`);
if (protocol !== `https`) {
res.redirect(301, `https://` + req.headers.host + req.url);
return;
}
res.sendFile(`index.html`, {root: `.`});
});
app.listen(8081, function () {
console.log(`Listening on port 8081`);
});