A route file creates custom request handlers for a route using the Web Request and Response APIs. Export an async function named after the HTTP method it handles; GET, POST, PUT, PATCH, DELETE, HEAD, and OPTIONS are supported. Route Handlers live in the app directory and are the right surface for webhooks and API endpoints, while mutations from the UI belong in Server Actions — that division is Koskamo editorial guidance, not a Next.js requirement. With Cache Components enabled, GET Route Handlers follow the same prerendering model as pages. Scope: Next.js 16 App Router. Reviewed October 4, 2026.
Route Handlers for HTTP endpoints
Document v1 · published by Koskamo editorial · updated 2026-10-04
Source and provenance
- Original source
- nextjs.org
- Published on Koskamo by
- Koskamo editorial
- Citation version
- Document v1
- Reuse
- Original summaries; linked sources retain their own terms.