File size: 1,095 Bytes
f535bab |
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 35 36 37 38 39 40 41 42 43 44 45 |
import { sendSuccess, ErrorResponses } from "../../lib/response-helper.js";
import { Komiku } from "./komiku.js"
/** @type {import("../../types/plugin.ts").ApiPluginHandler}*/
const handler = {
name: "Komiku: Get the latest manga",
method: "GET",
version: "1.0.0",
category: ["komiku"],
alias: ["getLatestManga"],
tags: ["comic"],
responses: {
200: {
status: 200,
description: "Successfully retrieved data",
example: {
status: 200,
author: "Ditzzy",
note: "Thank you for using this API!",
results: {}
}
},
500: {
status: 500,
description: "Server error or unavailable",
example: {
status: 500,
message: "An error occurred, please try again later."
}
}
},
exec: async (_req, res) => {
const komik = new Komiku();
try {
const latest = await komik.getLatestPopularManga();
sendSuccess(res, latest.results)
} catch (e) {
ErrorResponses.serverError(res, "An error occurred, try again later.");
}
}
}
export default handler;
|