Back

File-Based Routing

In Next.js you don't set up a router manually. Just create a file and it becomes a page automatically. The file name and folder structure define the URL.

app/
  page.tsx              →  /
  about/
    page.tsx            →  /about
  blog/
    page.tsx            →  /blog
    [id]/
      page.tsx          →  /blog/123
  api/
    users/
      route.ts          →  /api/users

Roadmap