Files
AniKotoAPI/src/controllers/random.controller.js
T
Sʜɪɴᴇɪ Nᴏᴜᴢᴇɴ 3815521b0d feat: initial project setup for AniKatoAPI
- Express.js server with Vercel deployment support
- Complete API endpoints for anikototv.to anime data
- Home, search, info, episodes, stream, schedule endpoints
- Category filtering and genre support
- Caching system with 5-minute TTL
- CORS configuration
- Public documentation page
- Docker and Render deployment configs
- MIT License
2026-06-08 15:08:22 +05:30

20 lines
524 B
JavaScript

import { extractRandom } from "../extractors/random.extractor.js";
import { getCache, setCache } from "../helper/cache.helper.js";
const getRandom = async (req, res, next) => {
try {
const cacheKey = "random";
const cached = getCache(cacheKey);
if (cached) {
return res.json({ success: true, results: cached });
}
const data = await extractRandom();
setCache(cacheKey, data);
res.json({ success: true, results: data });
} catch (error) {
next(error);
}
};
export { getRandom };