storytellurx-v1/main.ts
Elias Rhouzlane e170af29ba feat: reopen V1 (/ is the start page again); run on the HEAD VPS with doco-cd
The maintenance page of 10 Feb 2026 replaced / only; /start, /chat, /about kept
working. deploy/ builds what mf.toml builds, with the secrets MF had now in
fnox.toml (age: Elias + the HEAD VPS key), served at v1.storytellurx.fuckingtech.ch.
2026-11-03 18:02:55 +01:00

31 lines
1.4 KiB
TypeScript

import snapshot from "./build/snapshot.json" with { type: "json" };
import tailwind from "./build/tailwind/snapshot.json" with { type: "json" };
import { createStaticHandler } from "@bureaudouble/outils/routes/createStaticHandler.ts";
import { createHandlers } from "@bureaudouble/rsc/server";
import { createRouter } from "@bureaudouble/routeur";
import { createCachedDataHandler } from "@bureaudouble/antichamber";
import * as ApiChat from "./app/api/chat/route.ts";
const { statics, actions, render } = createHandlers(snapshot);
const gp = ["GET" as const, "POST" as const];
const router = createRouter()
.get(tailwind.pathname, createCachedDataHandler(tailwind))
.get(snapshot.statics.pathname, statics)
.post(snapshot.actions.pathname, actions)
.on(gp, "/", render(import("@/app/pages/start.tsx")))
.on(gp, "/start", render(import("@/app/pages/start.tsx")))
.on(gp, "/chat", render(import("@/app/pages/index.tsx")))
.on(gp, "/about{/}?", render(import("@/app/pages/about.tsx")))
.on(gp, "/history{/}?", render(import("@/app/pages/history.tsx")))
.get("/build/*", statics)
.post("/api/chat{/}?", (ctx) => ApiChat.POST(ctx.request))
.post("/actions{/}?", actions)
.get("/public/*", createStaticHandler({ baseUrl: import.meta.url }))
.default(() => new Response("Not found", { status: 404 }))
.error(
(error) => console.error(error) ?? new Response("Error", { status: 500 }),
);
export default router satisfies Deno.ServeDefaultExport;