InterviewBuddy
All interview questions

What is a Route Handler?

Intermediate

Answer

A Route Handler is a server endpoint defined in a route.ts file. It exports functions for HTTP methods such as GET and POST and returns a Web Response.

Explanation

Use it when another client needs an HTTP API or you need explicit request handling. Protect private routes with authentication and authorization.

Example

export async function GET() { return Response.json({ok:true}); }