主题
访问控制
页面访问规则
bash
next-app/
app/
dashboard/
test.tsx # ❌ 不会映射成 localhost:3000/dashboard/test
page.tsx # ✅ 会映射成 localhost:3000/dashboardbash
next-app/
pages/
dashboard/
test.tsx # ✅ 会映射成 localhost:3000/dashboard/test
page.tsx # ✅ 会映射成 localhost:3000/dashboard/page私有文件夹
私有文件夹中的文件不会被直接访问。
bash
next-app/
app/
_lib/
format-date.ts
page.tsx路由组
通过 () 定义路由组,不会影响到访问的 url path,可以更方便地进行路由管理。
bash
next-app/
app/
(auth)/
login/
page.tsx # localhost:3000/login
register/
page.tsx # localhost:3000/register
forget-password/
page.tsx # localhost:3000/forget-password