WIP! A BB-style forum, on the ATmosphere! We're still working... we'll be back soon when we have something to show off!
node typescript hono htmx atproto
4
fork

Configure Feed

Select the types of activity you want to include in your feed.

at main 33 lines 974 B view raw
1import { Hono } from "hono"; 2import type { AppContext } from "../lib/app-context.js"; 3import { forums } from "@atbb/db"; 4import { eq } from "drizzle-orm"; 5import { serializeForum } from "./helpers.js"; 6import { handleRouteError } from "../lib/route-errors.js"; 7 8/** 9 * Factory function that creates forum routes with access to app context. 10 */ 11export function createForumRoutes(ctx: AppContext) { 12 return new Hono().get("/", async (c) => { 13 try { 14 // Query the singleton forum metadata record (rkey = "self") 15 const [forum] = await ctx.db 16 .select() 17 .from(forums) 18 .where(eq(forums.rkey, "self")) 19 .limit(1); 20 21 if (!forum) { 22 return c.json({ error: "Forum not found" }, 404); 23 } 24 25 return c.json(serializeForum(forum)); 26 } catch (error) { 27 return handleRouteError(c, error, "Failed to retrieve forum metadata", { 28 operation: "GET /api/forum", 29 logger: ctx.logger, 30 }); 31 } 32 }); 33}