import { swaggerUI } from "@hono/swagger-ui"; import { OpenAPIHono } from "@hono/zod-openapi"; import { maybeUpdateLastConnectedAt } from "~/controllers/maybeUpdateLastConnectedAt"; const app = new OpenAPIHono(); app.use(maybeUpdateLastConnectedAt); app.route( "/", await import("~/controllers/health-check").then( (controller) => controller.default, ), ); app.route( "/title", await import("~/controllers/title").then((controller) => controller.default), ); app.route( "/episodes", await import("~/controllers/episodes").then( (controller) => controller.default, ), ); app.route( "/search", await import("~/controllers/search").then((controller) => controller.default), ); app.route( "/watch-status", await import("~/controllers/watch-status").then( (controller) => controller.default, ), ); app.route( "/token", await import("~/controllers/token").then((controller) => controller.default), ); app.route( "/auth", await import("~/controllers/auth").then((controller) => controller.default), ); app.route( "/internal", await import("~/controllers/internal").then( (controller) => controller.default, ), ); // The OpenAPI documentation will be available at /doc app.doc("/openapi.json", { openapi: "3.0.0", info: { version: "1.0.0", title: "Aniplay API", }, }); app.get("/docs", swaggerUI({ url: "/openapi.json" })); export default app;