mirror of
https://github.com/Shineii86/AniKotoAPI.git
synced 2026-10-22 10:55:10 +00:00
v1.5.0: Complete documentation rewrite - 50+ files with AlisaReactionBot style
- Box-style header comments (Project, Author, License) on every file - Section headers using double-line box decorators - Feature markers (// ---- FEATURE: XYZ ----) before every major function - JSDoc comments for EVERY function with @param, @returns, @example - Inline notes (NOTE, WARNING, TIP) for non-obvious logic - Footer END markers on every module - Matched code style to AlisaReactionBot repository - All files now searchable by feature name via grep Author: Shinei Nouzen <157171073+Shineii86@users.noreply.github.com>
This commit is contained in:
@@ -1,6 +1,42 @@
|
||||
/*
|
||||
* ======= • ======= • ======= • ======= • =======• =======
|
||||
* AniKatoAPI — spotlight.controller.js
|
||||
* Repository: https://github.com/Shineii86/AniKatoAPI
|
||||
*
|
||||
* @description
|
||||
* Controller for spotlight/featured anime carousel data.
|
||||
* Returns a list of featured anime with banners and descriptions.
|
||||
* No parameters required - returns fixed spotlight content.
|
||||
*
|
||||
* @exports
|
||||
* getSpotlight - Express route handler for GET /api/spotlight
|
||||
*
|
||||
* @author Shinei Nouzen
|
||||
* @license MIT
|
||||
* ======= • ======= • ======= • ======= • =======• =======
|
||||
*/
|
||||
|
||||
import { extractSpotlight } from "../extractors/spotlight.extractor.js";
|
||||
import { getCache, setCache } from "../helper/cache.helper.js";
|
||||
|
||||
// ══════════════════════════════════════════════════════════════
|
||||
// CONTROLLER: SPOTLIGHT
|
||||
// ══════════════════════════════════════════════════════════════
|
||||
|
||||
// ---- FEATURE: Spotlight carousel endpoint ----
|
||||
/**
|
||||
* Handles GET /api/spotlight requests. Returns featured anime
|
||||
* data for the homepage spotlight carousel.
|
||||
*
|
||||
* @param {object} req - Express request object
|
||||
* @param {object} res - Express response object
|
||||
* @param {Function} next - Express next middleware function
|
||||
* @returns {void} Sends JSON response with spotlight anime list
|
||||
*
|
||||
* @example
|
||||
* GET /api/spotlight
|
||||
* Response: { success: true, results: [{ title, banner, ... }] }
|
||||
*/
|
||||
const getSpotlight = async (req, res, next) => {
|
||||
try {
|
||||
const cacheKey = "spotlight";
|
||||
@@ -8,7 +44,6 @@ const getSpotlight = async (req, res, next) => {
|
||||
if (cached) {
|
||||
return res.json({ success: true, results: cached });
|
||||
}
|
||||
|
||||
const data = await extractSpotlight();
|
||||
setCache(cacheKey, data);
|
||||
res.json({ success: true, results: data });
|
||||
@@ -17,4 +52,6 @@ const getSpotlight = async (req, res, next) => {
|
||||
}
|
||||
};
|
||||
|
||||
export { getSpotlight };
|
||||
export { getSpotlight };
|
||||
|
||||
// ══════════════════════════════════════════════════════════════ END: spotlight.controller.js
|
||||
Reference in New Issue
Block a user