summaryrefslogtreecommitdiff
path: root/main.js
blob: 0b04edd62d9b5af6a9f6fa3dffebefbb06b73977 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import express from 'express';

import helmet from './middlewares/helmet.js';
import gamesRouter from './routes/games.js';
import rootRouter from './routes/root.js';

const app = express();
app.set('trust proxy', 1);
app.use(helmet);

app.set('views', './views');
app.set('view engine', 'ejs');

app.use('/games', gamesRouter);
app.use('/static', express.static('static'));
app.use('/', rootRouter);

if (process.env.NODE_ENV !== 'test') {
	const port = process.env.PORT || 3000;
	app.listen(port, () => console.log(`listening on port ${port}`));
}

export default app;