14 lines
438 B
TypeScript
14 lines
438 B
TypeScript
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();
|
|
return Response.json({ received: body });
|
|
};
|