-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.ts
63 lines (45 loc) · 1.1 KB
/
app.ts
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
import compression from "compression";
import cors from "cors";
import express from "express";
import helmet from "helmet";
import { Server } from "socket.io";
import { httpServerLogger } from "./config/winston";
import birds from "./games/birds";
import drawWithFriends from "./games/draw";
import polls from "./games/polls";
import randomMember from "./games/random";
import trivia from "./games/trivia";
import werewolf from "./games/werewolf";
import wouldYouRather from "./games/would-you-rather";
require("dotenv").config();
const app = express();
/**
* App Middleware
*/
app.use(cors());
app.use(compression());
app.use(helmet());
/**
* App Routes
*/
app.get("/", (req, res) => res.send("Soapbox Apps Server"));
/**
* App Startup
*/
app.set("PORT", process.env.PORT || 8080);
const httpServer = app.listen(app.get("PORT"), () => {
httpServerLogger.info(`listening at ${app.get("PORT")}`);
});
const io = new Server(httpServer, {
cors: { origin: "*" },
});
/**
* Socket.io Handlers
*/
drawWithFriends(io);
randomMember(io);
polls(io);
birds(io);
wouldYouRather(io);
trivia(io);
werewolf(io);