-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
29 lines (20 loc) · 691 Bytes
/
index.js
File metadata and controls
29 lines (20 loc) · 691 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
26
27
28
'use strict';
const {createServer} = require('http');
const next = require('next');
const dev = process.env.NODE_ENV !== 'production';
const nextApp = next({dev});
const handle = nextApp.getRequestHandler();
const ws = require('./server/core/ws');
const express = require('./server/core/express');
global.session = require("express-session")({
secret: "my-secret",
resave: true,
saveUninitialized: true
});
(async () => {
await nextApp.prepare();
const Express = new express(handle);
const httpServer = createServer(Express);
const WebSocket = new ws(httpServer);
httpServer.listen(3000, () => console.log(`http/ws server listening on 3000`));
})();