Skip to content

Commit

Permalink
Add test api
Browse files Browse the repository at this point in the history
  • Loading branch information
hanydd committed Nov 4, 2024
1 parent be363a6 commit f259920
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down Expand Up @@ -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);
}
7 changes: 7 additions & 0 deletions src/testApi.ts
Original file line number Diff line number Diff line change
@@ -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");
}

0 comments on commit f259920

Please sign in to comment.