ryu-js / plugins /hentai.js
randydev's picture
Update plugins/hentai.js
a50d811 verified
raw
history blame
973 Bytes
import express from 'express';
import { AnimeHentai } from '../lib/scrapper.js';
import { authenticateApiKey, apiLimiter } from '../middleware/midware.js';
const HentaiRoutes = express.Router();
/**
* @swagger
* /api/v1/anime/hentai:
* get:
* summary: Hentai Anime Random
* tags: [Anime]
* parameters:
* - in: header
* name: x-api-key
* required: true
* description: API key for authentication
* schema:
* type: string
* responses:
* 200:
* description: Success
*/
HentaiRoutes.get('/api/v1/anime/hentai', authenticateApiKey, apiLimiter, async (req, res) => {
try {
const result = await AnimeHentai();
if (result) {
res.json({ result });
} else {
res.status(404).json({ error: "No result found." });
}
} catch (error) {
res.status(500).json({ error: error.message });
}
});
export { HentaiRoutes };