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:
Sʜɪɴᴇɪ Nᴏᴜᴢᴇɴ
2026-06-08 15:34:37 +05:30
parent cff5b394b3
commit 47789b2444
13 changed files with 632 additions and 1 deletions
+27
View File
@@ -0,0 +1,27 @@
import { extractStatus } from "../extractors/status.extractor.js";
import { getCache, setCache } from "../helper/cache.helper.js";
const getStatus = async (req, res, next) => {
try {
const { status } = req.params;
const { page = 1 } = req.query;
if (!status) {
return res.status(400).json({ success: false, message: "Status is required (currently-airing, finished-airing, not-yet-aired)" });
}
const cacheKey = `status_${status}_${page}`;
const cached = getCache(cacheKey);
if (cached) {
return res.json({ success: true, results: cached });
}
const data = await extractStatus(status, page);
setCache(cacheKey, data);
res.json({ success: true, results: data });
} catch (error) {
next(error);
}
};
export { getStatus };