Next.js · Junior · Question 42 of 75
What happens if app/dashboard/ contains both page.tsx and route.ts?
- ✓Correct answer: A build error: these files conflict over the same URL
- 2GET requests go to
route.ts, the rest topage.tsx - 3The page renders, and
route.tsis ignored
Explanation
Both files claim the same URL, and Next.js reports a conflict. API routes are usually moved into a separate branch, e.g. app/api/....