generated from WebJamApps/CollegeLutheran
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.js
More file actions
23 lines (18 loc) · 837 Bytes
/
server.js
File metadata and controls
23 lines (18 loc) · 837 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
/* eslint-disable @typescript-eslint/no-var-requires */
// DO NOT DELETE THIS FILE - IT IS USED BY HEROKU FOR HOSTING THIS APP
require('dotenv').config();
const path = require('path');
const express = require('express');
const enforce = require('express-sslify');
const app = express();
/* istanbul ignore if */
if (process.env.NODE_ENV === 'production') app.use(enforce.HTTPS({ trustProtoHeader: true }));
app.use(express.static(path.normalize(path.join(__dirname, 'dist'))));
app.use('/', express.static(path.normalize(path.join(__dirname, 'dist'))));
app.get('/*', (request, response) => {
response.sendFile(path.normalize(path.join(__dirname, 'dist/index.html')));
});
app.listen(process.env.PORT, () => {
console.log(`Magic happens on port ${process.env.PORT}`); // eslint-disable-line no-console
});
module.exports = app;