aboutsummaryrefslogtreecommitdiffstats
path: root/backend/ts/index.ts
diff options
context:
space:
mode:
authorMaks Jopek <maksymilian.jopek@prym-soft.pl>2021-04-10 01:06:09 +0200
committerMaks Jopek <maksymilian.jopek@prym-soft.pl>2021-04-10 01:06:09 +0200
commitdd66b8ad239d5ceae219746a702963645259b784 (patch)
tree47462463911a018a31cd1ede3d8206fd96032b99 /backend/ts/index.ts
parentd928eab3ecefbf778f1cadece9beac010dc42332 (diff)
downloadfia-dd66b8ad239d5ceae219746a702963645259b784.tar.gz
fia-dd66b8ad239d5ceae219746a702963645259b784.tar.zst
fia-dd66b8ad239d5ceae219746a702963645259b784.zip
Added joining rooms and logic to start game by votes
Diffstat (limited to 'backend/ts/index.ts')
-rw-r--r--backend/ts/index.ts25
1 files changed, 15 insertions, 10 deletions
diff --git a/backend/ts/index.ts b/backend/ts/index.ts
index ead29f2..6b12571 100644
--- a/backend/ts/index.ts
+++ b/backend/ts/index.ts
@@ -1,24 +1,29 @@
import express from "express";
-import login from "./api/login";
import session from "express-session";
import * as dotenv from "dotenv";
+import login from "./api/login";
+import startPoint from "./api/startPoint";
+import readyStateToggle from "./api/readyStateToggle";
+
dotenv.config();
const app = express();
const PORT = 8000;
-if (!process.env.SESSION_KEY) process.env.SESSION_KEY = "ouh2981w1pjd9";
-// throw Error("SESSION_KEY is undefined");
+if (!process.env.SESSION_KEY)
+ throw Error("SESSION_KEY is undefined");
-app.use(
- session({ secret: process.env.SESSION_KEY, cookie: { maxAge: 60000 } })
-);
+app.use(session({ secret: process.env.SESSION_KEY, cookie: { maxAge: 60000 } }));
+app.use(express.json());
app.use("/", express.static("./public"));
-app.get("/favicon.ico", (req, res) =>
- res.redirect("https://lukesmith.xyz/favicon.ico")
-);
-app.post("/login", (req, res) => login(req, res));
+app.get("/favicon.ico", (req, res) => res.redirect("https://lukesmith.xyz/favicon.ico"));
+
+app.get("/startPoint", startPoint)
+
+app.post("/login", login);
+app.post("/readyStateToggle", readyStateToggle);
+
app.listen(PORT, () => {
console.log(`[server]: Server is running at https://localhost:${PORT}`);