File size: 813 Bytes
a6fbcb7
 
 
 
5e7b9a9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
a6fbcb7
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import express from 'express';
import { AnimeHentai } from '../scrapper.js';
const HentaiRoutes = express.Router();

/**
 * @swagger
 * /api/v1/hentai-anime:
 *   get:
 *     summary: Hentai Anime Random
 *     parameters:
 *       - in: query
 *         name: query
 *         required: true
 *         description: null
 *         schema:
 *           type: string
 *     responses:
 *       200:
 *         description: Success
 */
HentaiRoutes.get('/api/v1/hentai-anime', 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 };