forked from poseidon-network/poseidon.network
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.ts
More file actions
25 lines (20 loc) · 695 Bytes
/
server.ts
File metadata and controls
25 lines (20 loc) · 695 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
import * as express from 'express';
import * as next from 'next';
import * as compression from 'compression';
// @ts-ignore
import nextI18NextMiddleware from 'next-i18next/middleware';
import nextI18next from './i18n';
const port = process.env.PORT || 3000;
const app = next({ dev: process.env.NODE_ENV !== 'production' });
const handle = app.getRequestHandler();
(async () => {
await app.prepare();
const server = express();
server.use(compression());
server.use(nextI18NextMiddleware(nextI18next));
server.get('*', (req, res) => handle(req, res));
server.listen(port, (err: any) => {
if (err) throw err;
console.log(`> Ready on http://localhost:${port}`);
});
})();