export default { async fetch(request: Request, env: Env) { if (request.method !== "POST") { return new Response("Method Not Allowed", { status: 405 }); } const body = await request.json().catch(() => null); if (!body) return new Response("Bad Request", { status: 400 }); const key = `calc:${Date.now()}:${crypto.randomUUID()}`; await env.CALCULATOR_LOGGING.put(key, JSON.stringify(body)); return new Response(JSON.stringify({ ok: true, key }), { headers: { "content-type": "application/json" }, }); }, } satisfies ExportedHandler;