export async function onRequestPost(context) { const data = await context.request.json(); // Add server-side fields data.status = 'pending'; data.created_date = new Date().toISOString(); // Call Base44 API - PUT YOUR API KEY IN CLOUDFLARE ENV VARS const res = await fetch('https://api.base44.com/entities/Booking', { method: 'POST', headers: { 'Content-Type': 'application/json', 'Authorization': `Bearer ${context.env.BASE44_API_KEY}` }, body: JSON.stringify(data) }); if (res.ok) { return new Response(JSON.stringify({ success: true }), { headers: { 'Content-Type': 'application/json' } }); } else { return new Response(JSON.stringify({ error: 'Failed' }), { status: 500, headers: { 'Content-Type': 'application/json' } }); } }