A Cloudflare Worker which works in conjunction with https://github.com/indexxing/bsky-alt-text
1import { fromHono } from "chanfana";
2import { Hono } from "hono";
3import { TaskCreate } from "./endpoints/taskCreate";
4import { TaskDelete } from "./endpoints/taskDelete";
5import { TaskFetch } from "./endpoints/taskFetch";
6import { TaskList } from "./endpoints/taskList";
7
8// Start a Hono app
9const app = new Hono<{ Bindings: Env }>();
10
11// Setup OpenAPI registry
12const openapi = fromHono(app, {
13 docs_url: "/",
14});
15
16// Register OpenAPI endpoints
17openapi.get("/api/tasks", TaskList);
18openapi.post("/api/tasks", TaskCreate);
19openapi.get("/api/tasks/:taskSlug", TaskFetch);
20openapi.delete("/api/tasks/:taskSlug", TaskDelete);
21
22// You may also register routes for non OpenAPI directly on Hono
23// app.get('/test', (c) => c.text('Hono!'))
24
25// Export the Hono app
26export default app;