Next.js Discord

Discord Forum

Do these api folders have special reserved meanings?

Answered
King Shepherd posted this in #help-forum
Open in Discord
King ShepherdOP
Do any of the directories in this heirarchy need to be named the way that they are named? Also what happens when you name a folder [...nextauth]?
Answered by joulev
Do any of the directories in this heirarchy need to be named the way that they are named?
for next-auth it's required to name it that way yes
Also what happens when you name a folder [...nextauth]?
it's a [catch-all dynamic segment](https://nextjs.org/docs/app/building-your-application/routing/dynamic-routes#catch-all-segments)
View full answer

4 Replies

@King Shepherd Do any of the directories in this heirarchy need to be named the way that they are named? Also what happens when you name a folder [...nextauth]?
Do any of the directories in this heirarchy need to be named the way that they are named?
for next-auth it's required to name it that way yes
Also what happens when you name a folder [...nextauth]?
it's a [catch-all dynamic segment](https://nextjs.org/docs/app/building-your-application/routing/dynamic-routes#catch-all-segments)
Answer
@King Shepherd thank you! Is that for all the directories even up to api?
For next-auth then it’s due to internal logic, you must name it /api/auth/[…nextauth]. But that doesn’t apply to route handlers; route handlers /can/be/anywhere/route.ts