Loading
A file that defines how your server responds to web requests at a specific URL — like a receptionist assigned to answer calls on a specific phone line.
A file (route.ts) in the app/ directory that exports HTTP method functions (GET, POST, PUT, DELETE) to handle API requests. Route handlers receive a Request object and return a Response, following Web API standards.
Route handlers are edge-compatible by default and export named functions per HTTP method. They receive NextRequest (extending Request with cookies, nextUrl, and geo) and can return NextResponse. Dynamic segments, route segment config (runtime, revalidate, dynamic), and request deduplication apply. Route handlers in the same route segment as page.tsx will shadow the page — they cannot coexist at the same path.