Route Handlers

A Route Handler is a route.ts file that defines an HTTP entry point in the App Router. It exports functions named after the methods (GET, POST), receives a request, and returns a response. It lets you build an API inside the Next.js application.

Example

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

Related concepts

The whole glossary