This commit is contained in:
PxlLoewe
2025-03-16 13:56:18 -07:00
parent cf61740698
commit 4862f73612
26 changed files with 1268 additions and 160 deletions

View File

@@ -6,6 +6,8 @@ import { createAdapter } from "@socket.io/redis-adapter";
import { jwtMiddleware } from "modules/socketJWTmiddleware";
import { pubClient, subClient } from "modules/redis";
import { handle } from "socket-events/connect-dispatch";
import router from "routes/router";
import cors from "cors";
const app = express();
const server = createServer(app);
@@ -14,12 +16,15 @@ const io = new Server(server, {
adapter: createAdapter(pubClient, subClient),
cors: {},
});
io.use(jwtMiddleware);
io.on("connection", (socket) => {
socket.on("connect-dispatch", handle(socket, io));
});
app.use(cors());
app.use(router);
server.listen(process.env.PORT, () => {
console.log(`Server running on port ${process.env.PORT}`);
});