diff --git a/quc/src/worker.js b/quc/src/worker.js new file mode 100644 index 0000000..c61a1fd --- /dev/null +++ b/quc/src/worker.js @@ -0,0 +1,52 @@ +// quc: app shell + API in one Worker (no build step; the same module runs on Cloudflare and under dev.mjs). +// GET / the shell GET /chair.svg the chair-in-the-corner motif +// GET /api/health {ok, rev} anything else 404 +// Fonts: system stacks on purpose (no webfont files, no third-party requests). shortcut: swap in self-hosted fonts when the brand picks them. + +export const CHAIR = ` + + +`; + +export const PAGE = ` + +quc + + +
quc
+

Coming together.

The app shell is up. Nothing to do here yet.

checking…

+ + +`; + +const headers = (type, extra = {}) => ({ "content-type": type, ...extra }); + +export default { + async fetch(req, env = {}) { + const { pathname } = new URL(req.url); + if (req.method !== "GET" && req.method !== "HEAD") return new Response("method not allowed", { status: 405 }); + if (pathname === "/api/health") return Response.json({ ok: true, rev: env.REV || "" }, { headers: { "cache-control": "no-store" } }); + if (pathname === "/chair.svg") return new Response(CHAIR, { headers: headers("image/svg+xml", { "cache-control": "public, max-age=3600" }) }); + if (pathname === "/" || pathname === "/index.html") return new Response(PAGE, { headers: headers("text/html; charset=utf-8") }); + return new Response("not found", { status: 404 }); + }, +};