App Routerでは、app/内のフォルダ構造がルートを定義します。ルータ設定を書く必要がありません。各フォルダはURLセグメントであり、その中の特別なファイルがそのセグメントで何をレンダリングするかを定義します。
フォルダ = URLセグメント
text
app/
page.tsx → /
about/page.tsx → /about
blog/page.tsx → /blog
blog/[slug]/page.tsx → /blog/:slug (dynamic segment)
shop/(sale)/page.tsx → /shop (route group — parentheses don't add to URL)
特別なファイル
各フォルダには予約済みファイル名を含めることができ、それぞれが特定の役割を持ちます:
text
page.tsx → the route's UI (REQUIRED to make a segment routable)
layout.tsx → shared wrapper that persists across child routes
loading.tsx → loading UI (auto-wraps the page in <Suspense>)
error.tsx → error boundary for the segment
not-found.tsx→ 404 UI
route.ts → an API endpoint (instead of a page)
