Next.js Discord

Discord Forum

Dynaimc API Routing with 2 required params

Answered
Barbary Lion posted this in #help-forum
Open in Discord
Barbary LionOP
How can I achieve that /:param1/:param2 these two are required? If I do the [...params] syntax they are optional.
Answered by joulev
/[param1]/[param2]/page.tsx
View full answer

6 Replies

Answer
Barbary LionOP
Oh perfect, ty
@joulev /[param1]/[param2]/page.tsx
Barbary LionOP
Wait, does that also work for API routes? That's what I need. As I tested it now and it doesn't work. https://img.walkaisa.dev/Sbj7dvCPEo
@joulev [planId is missing a ]
Barbary LionOP
Damn I’m blind… I’m sorry 🤦🏽‍♂️
Ty