Route Handlers
A route.ts file exports functions named after HTTP methods (GET, POST, ...) that receive a web-standard Request and return a Response, giving you API endpoints inside the app/ directory for webhooks, OAuth callbacks, and non-React clients. A segment can define page.tsx or route.ts, never both, and GET handlers can be statically cached under the same rules as pages.
This Concept is waiting for its first lesson!
A route.ts file exports functions named after HTTP methods (GET, POST, ...) that receive a web-standard Request and return a Response, giving you API endpoints inside the app/ directory for webhooks, OAuth callbacks, and non-React clients. A segment can define page.tsx or route.ts, never both, and GET handlers can be statically cached under the same rules as pages.
Are you a teacher? Sign in to start contributing.
Sign In