mirror of
https://github.com/Shineii86/AniKotoAPI.git
synced 2026-10-22 19:05:11 +00:00
feat: add complete API endpoints for full website
- Add /api/watch endpoint for watch page data - Add /api/az-list for alphabetical browsing - Add /api/new-release and /api/newly-added - Add /api/status for ongoing/completed lists - Add /api/trending-sidebar for sidebar data - Update README with all new endpoints - Update CHANGELOG
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
import { extractAzList } from "../extractors/azList.extractor.js";
|
||||
import { getCache, setCache } from "../helper/cache.helper.js";
|
||||
|
||||
const getAzList = async (req, res, next) => {
|
||||
try {
|
||||
const { letter = "all" } = req.params;
|
||||
const { page = 1 } = req.query;
|
||||
|
||||
const cacheKey = `azlist_${letter}_${page}`;
|
||||
const cached = getCache(cacheKey);
|
||||
if (cached) {
|
||||
return res.json({ success: true, results: cached });
|
||||
}
|
||||
|
||||
const data = await extractAzList(letter, page);
|
||||
setCache(cacheKey, data);
|
||||
res.json({ success: true, results: data });
|
||||
} catch (error) {
|
||||
next(error);
|
||||
}
|
||||
};
|
||||
|
||||
export { getAzList };
|
||||
Reference in New Issue
Block a user