Skip to main content

Nested Routes

Nested routes are created by folder depth under your apiDir: each folder adds a segment to the URL. Combine static segments, dynamic segments, and route groups to build nested paths.

Example

  • api/users/route.ts/api/users
  • api/users/[id]/route.ts/api/users/:id
  • api/users/[id]/posts/route.ts/api/users/:id/posts

For static and dynamic behavior, see Static Routes, Dynamic Routes, and Route Groups.