Data & APIs
Route handlers
typescript
export async function GET() {
return Response.json({ ok: true });
}
export async function POST(request: Request) {
const body = await request.json();
return Response.json({ received: body });
}Treat route handlers as API boundaries. Validate method, authentication, authorization, content type and input before performing privileged work.
Lesson complete?Use the next lesson to continue the learning path.