aboutsummaryrefslogtreecommitdiff
path: root/back/src/server.ts
blob: c73162a6be7cc3709f20d962f60945da3966933b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import fs from 'fs';
import http from 'http';
import https from 'https';
import {Server} from 'socket.io';

export default new Server({cors: {origin: process.env.ORIGIN, methods: ['GET', 'POST']}});

/*const base = process.env.SSL_KEY && process.env.SSL_CERT && process.env.SSL_CA ? https.createServer({
	"key": fs.readFileSync(process.env.SSL_KEY),
  "cert": fs.readFileSync(process.env.SSL_CERT),
  "ca": fs.readFileSync(process.env.SSL_CA)
}) : http.createServer();
base.listen(+process.env.PORT!, '0.0.0.0', () => {
	console.log(`Listening on port ${process.env.PORT}`);
});

export default new Server(base, {cors: {origin: process.env.ORIGIN, methods: ['GET', 'POST']}});*/