Skip to content

Commit

Permalink
feat(/qtip): add new /qtip endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
ghoshRitesh12 committed Dec 25, 2024
1 parent c4d4c1e commit f0acd89
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/routes/hianime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,20 @@ hianimeRouter.get("/azlist/:sortOption", async (c) => {
return c.json({ success: true, data }, { status: 200 });
});

// /api/v2/hianime/qtip/{animeId}
hianimeRouter.get("/qtip/:animeId", async (c) => {
const cacheConfig = c.get("CACHE_CONFIG");
const animeId = decodeURIComponent(c.req.param("animeId").trim());

const data = await cache.getOrSet<HiAnime.ScrapedAnimeQtipInfo>(
async () => hianime.getQtipInfo(animeId),
cacheConfig.key,
cacheConfig.duration
);

return c.json({ success: true, data }, { status: 200 });
});

// /api/v2/hianime/category/{name}?page={page}
hianimeRouter.get("/category/:name", async (c) => {
const cacheConfig = c.get("CACHE_CONFIG");
Expand Down

0 comments on commit f0acd89

Please sign in to comment.