CodeZettaInterview Hub

Next.js · Route Handlers · Fresh / Intern · Concept

What are Route Handlers in the App Router?

Short Interview Answer

`route.ts` files exporting HTTP method functions to build API endpoints.

Detailed Explanation

They replace many Pages API routes. Can run on Node or Edge runtime. Good for webhooks, auth callbacks, and JSON APIs colocated with the app.

Example

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

Did you know this answer?