Flatlogic Bot ef0c922762 Dave
2026-02-05 03:59:10 +00:00

31 lines
1.0 KiB
JavaScript

const express = require('express');
const router = express.Router();
const MangaScraperService = require('../services/mangaScraper');
const { wrapAsync } = require('../helpers');
router.get('/search', wrapAsync(async (req, res) => {
const { query, sourceId } = req.query;
const results = await MangaScraperService.search(query, sourceId);
res.json(results);
}));
router.get('/details/:sourceId/:mangaId', wrapAsync(async (req, res) => {
const { sourceId, mangaId } = req.params;
const details = await MangaScraperService.getMangaDetails(mangaId, sourceId);
res.json(details);
}));
router.get('/chapters/:sourceId/:mangaId', wrapAsync(async (req, res) => {
const { sourceId, mangaId } = req.params;
const chapters = await MangaScraperService.getChapters(mangaId, sourceId);
res.json(chapters);
}));
router.get('/pages/:sourceId/:chapterId', wrapAsync(async (req, res) => {
const { sourceId, chapterId } = req.params;
const pages = await MangaScraperService.getPages(chapterId, sourceId);
res.json(pages);
}));
module.exports = router;