refactor: dependency injection for GameSessionStore via composition root

This commit is contained in:
lila 2026-04-28 13:48:50 +02:00
parent 4f59f3bc14
commit a4a4bfff57
6 changed files with 107 additions and 79 deletions

View file

@ -1,11 +1,16 @@
import express from "express";
import { Router } from "express";
import type { Router } from "express";
import { healthRouter } from "./healthRouter.js";
import { gameRouter } from "./gameRouter.js";
import { createGameRouter } from "./gameRouter.js";
import { lobbyRouter } from "./lobbyRouter.js";
import type { GameSessionStore } from "../gameSessionStore/index.js";
export const apiRouter: Router = express.Router();
export const createApiRouter = (store: GameSessionStore): Router => {
const router = express.Router();
apiRouter.use("/health", healthRouter);
apiRouter.use("/game", gameRouter);
apiRouter.use("/lobbies", lobbyRouter);
router.use("/health", healthRouter);
router.use("/game", createGameRouter(store));
router.use("/lobbies", lobbyRouter);
return router;
};