-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.js
32 lines (27 loc) · 1.05 KB
/
index.js
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
28
29
30
31
32
require("./keepAlive")
const express = require('express');
const path = require('path');
const IS_DEV = !process.env.FLY_APP_NAME;
const PORT = process.env.PORT || 5000;
const VERSION = IS_DEV ? "dev-" + Date.now() : Date.now();
console.log(process.env)
const app = express();
app.use(express.static(path.join(__dirname, 'public')));
app.use(express.static(path.join(__dirname, 'favicon')));
// app.use(function forceLiveDomain(req, res, next) {
// if (req.get('Host') === 'multiverse-chess.fly.dev')
// return res.redirect(301, 'https://multiversechess.com' + req.originalUrl);
// return next();
// });
app.use(function (req, res, next) {
res.locals = {
VERSION: VERSION
};
next();
});
app.set('views', path.join(__dirname, 'views'));
app.set('view engine', 'ejs');
app.get('/', (req, res) => res.render('pages/index'));
app.get('/[abcdefghijkmnpqrstuvwxyzABCDEFGHJKLMNPQRTUVWXYZ2346789]{3}', (req, res) => res.render('pages/index'));
const server = app.listen(PORT, () => console.log(`Listening on ${ PORT }`));
require("./socket")(server, VERSION, IS_DEV);