Files
WRNexusJS/examples/basic-app/app/api/echo.ts
2026-07-12 15:55:18 +05:30

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 });
};