-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserver.js
24 lines (20 loc) · 965 Bytes
/
server.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
const express = require('express');
const next = require('next');
const port = parseInt(process.env.PORT, 10) || 3000;
const host = process.env.HOST || '0.0.0.0';
const dev = process.env.NODE_ENV !== 'production';
const app = next({ dev });
const handle = app.getRequestHandler();
app.prepare().then(() => {
const server = express();
server.get('/', (req, res) => app.render(req, res, '/index', req.query));
server.get('/manifesto', (req, res) => app.render(req, res, '/index', req.query));
server.get('/photos', (req, res) => app.render(req, res, '/photos', req.query));
server.get('/attributions', (req, res) => app.render(req, res, '/attributions', req.query));
server.get('/downloads', (req, res) => app.render(req, res, '/downloads', req.query));
server.get('*', (req, res) => handle(req, res));
server.listen(port, host, () => {
// eslint-disable-next-line no-console
console.log(`Ominidi.org ready on ${host}:${port}`);
});
});