mirror of
https://github.com/zkldi/Tachi.git
synced 2026-10-07 22:38:02 +03:00
mounting the API would be a good start...
This commit is contained in:
@@ -2,12 +2,14 @@ import { Router } from "express";
|
||||
import authRouter from "./auth/router";
|
||||
import importRouter from "./import/router";
|
||||
import statusRouter from "./status/router";
|
||||
import usersRouter from "./users/router";
|
||||
|
||||
const router: Router = Router({ mergeParams: true });
|
||||
|
||||
router.use("/auth", authRouter);
|
||||
router.use("/status", statusRouter);
|
||||
router.use("/import", importRouter);
|
||||
router.use("/users", usersRouter);
|
||||
|
||||
router.all("*", (req, res) =>
|
||||
res.status(404).json({
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
import t from "tap";
|
||||
import { CloseAllConnections } from "../../../../../../../../../test-utils/close-connections";
|
||||
import mockApi from "../../../../../../../../../test-utils/mock-api";
|
||||
import ResetDBState from "../../../../../../../../../test-utils/resets";
|
||||
|
||||
t.test("GET /api/v1/users/:userID/games/:game/:playtype/", (t) => {
|
||||
t.beforeEach(ResetDBState);
|
||||
|
||||
t.test("Should return a users statistics for that game.", async (t) => {
|
||||
const res = await mockApi.get("/api/v1/users/zkldi/games/iidx/SP");
|
||||
|
||||
t.strictSame(res.body, {});
|
||||
|
||||
t.end();
|
||||
});
|
||||
|
||||
t.end();
|
||||
});
|
||||
|
||||
t.teardown(CloseAllConnections);
|
||||
+3
@@ -2,6 +2,7 @@ import { Router } from "express";
|
||||
import db from "../../../../../../external/mongo/db";
|
||||
import { SYMBOL_TachiData } from "../../../../../../lib/constants/tachi";
|
||||
import { GetUserFromParam } from "./middleware";
|
||||
import gamePTRouter from "./games/_game/_playtype/router";
|
||||
|
||||
const router: Router = Router({ mergeParams: true });
|
||||
|
||||
@@ -40,4 +41,6 @@ router.get("/stats", async (req, res) => {
|
||||
});
|
||||
});
|
||||
|
||||
router.use("/games/:game/:playtype", gamePTRouter);
|
||||
|
||||
export default router;
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Router } from "express";
|
||||
import db from "../../../../../external/mongo/db";
|
||||
import userIDRouter from "./!userID/router";
|
||||
import userIDRouter from "./_userID/router";
|
||||
|
||||
const router: Router = Router({ mergeParams: true });
|
||||
|
||||
|
||||
Reference in New Issue
Block a user