From f259920d3f8b34276981c09e86c3225c825fa4fb Mon Sep 17 00:00:00 2001 From: hanyd Date: Mon, 4 Nov 2024 19:45:45 +0800 Subject: [PATCH] Add test api --- src/app.ts | 4 ++++ src/testApi.ts | 7 +++++++ 2 files changed, 11 insertions(+) create mode 100644 src/testApi.ts diff --git a/src/app.ts b/src/app.ts index f046ca30..fe1acacb 100644 --- a/src/app.ts +++ b/src/app.ts @@ -54,6 +54,7 @@ import { viewedVideoSponsorTime } from "./routes/viewedVideoSponsorTime"; import { voteOnPortVideo } from "./routes/voteOnPortVideo"; import { getUserID as voteGetUserID, voteOnSponsorTime } from "./routes/voteOnSponsorTime"; import { youtubeApiProxy } from "./routes/youtubeApiProxy"; +import { testApi } from "./testApi"; export function createServer(callback: () => void): Server { // Create a service (the app object is just a callback). @@ -219,4 +220,7 @@ function setupRoutes(router: Router, server: Server) { router.post("/api/votePort", voteOnPortVideo); router.post("/api/updatePortedSegments", updatePortedSegments); + + // test + router.get("/api/test", testApi); } diff --git a/src/testApi.ts b/src/testApi.ts new file mode 100644 index 00000000..9e716bf0 --- /dev/null +++ b/src/testApi.ts @@ -0,0 +1,7 @@ +import { QueryCacher } from "./utils/queryCacher"; +import { Request, Response } from "express"; + +export async function testApi(req: Request, res: Response) { + QueryCacher.clearKeyPattern(req.query.pattern as string); + return res.send("ok"); +}