wip version of the api
This commit is contained in:
parent
c24967dc74
commit
7d80b20390
8 changed files with 61 additions and 3 deletions
9
apps/api/src/routes/apiRouter.ts
Normal file
9
apps/api/src/routes/apiRouter.ts
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
import express from "express";
|
||||
import { Router } from "express";
|
||||
import { healthRouter } from "./healthRouter.js";
|
||||
import { gameRouter } from "./gameRouter.js";
|
||||
|
||||
export const apiRouter: Router = express.Router();
|
||||
|
||||
apiRouter.use("/health", healthRouter);
|
||||
apiRouter.use("/game", gameRouter);
|
||||
7
apps/api/src/routes/gameRouter.ts
Normal file
7
apps/api/src/routes/gameRouter.ts
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
import express from "express";
|
||||
import type { Router } from "express";
|
||||
import { createGame } from "../controllers/gameController.js";
|
||||
|
||||
export const gameRouter: Router = express.Router();
|
||||
|
||||
gameRouter.get("/", createGame);
|
||||
11
apps/api/src/routes/healthRouter.ts
Normal file
11
apps/api/src/routes/healthRouter.ts
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
import type { Request, Response } from "express";
|
||||
|
||||
export const healthRouter = (_req: Request, res: Response) => {
|
||||
res
|
||||
.status(200)
|
||||
.json({
|
||||
status: "ok",
|
||||
uptime: process.uptime(),
|
||||
timestamp: new Date().toISOString(),
|
||||
});
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue