1import { env } from "cloudflare:workers";
2
3/** JSON endpoint: reads the Text binding + asserts the ASSETS binding exists. */
4export function GET() {
5 return Response.json({
6 value: (env as Record<string, unknown>).FIXTURE_VALUE ?? null,
7 hasAssetsBinding:
8 typeof (env as { ASSETS?: { fetch?: unknown } }).ASSETS?.fetch ===
9 "function",
10 });
11}
12
13/** JSON echo for non-GET methods, proving on-demand API routing under SSR. */
14export async function POST({ request }: { request: Request }) {
15 const body = (await request.json()) as Record<string, unknown>;
16 return Response.json({ echoed: body, method: "POST" });
17}