import type { Context } from "@wrnexus/core"; // Demonstrates method-specific handlers on a single route file. // GET /api/echo -> usage hint // POST /api/echo -> echoes the JSON body back export const GET = async () => { return Response.json({ usage: "POST JSON here and it will be echoed back" }); }; export const POST = async (ctx: Context) => { const body = await ctx.req.json().catch(() => undefined); if (body === undefined) return Response.json( { error: "Request body must be valid JSON." }, { status: 400, headers: { "cache-control": "no-store" } }, ); return Response.json({ received: body }); };