Create hentai.js
Browse files- plugins/hentai.js +18 -0
plugins/hentai.js
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import express from 'express';
|
2 |
+
import { AnimeHentai } from '../scrapper.js';
|
3 |
+
const HentaiRoutes = express.Router();
|
4 |
+
|
5 |
+
HentaiRoutes.get('/api/v1/hentai-anime', async (req, res) => {
|
6 |
+
try {
|
7 |
+
const result = await AnimeHentai();
|
8 |
+
if (result) {
|
9 |
+
res.json({ result });
|
10 |
+
} else {
|
11 |
+
res.status(404).json({ error: "No result found." });
|
12 |
+
}
|
13 |
+
} catch (error) {
|
14 |
+
res.status(500).json({ error: error.message });
|
15 |
+
}
|
16 |
+
});
|
17 |
+
|
18 |
+
export { HentaiRoutes };
|