H
Hono4mo ago
bombillazo

Match both `/` and `/:id` routes the the same router

Hello, is there any way to handle 2 routes in the same router? We want to handle requests coming to both / and /:id to handle when id is undefined or has a value.
3 Replies
Aditya Mathur
Aditya Mathur4mo ago
You can place a ? mark like this /:id? this will make it either string or undefined
bombillazo
bombillazoOP4mo ago
Didn't know about that! Let me try, any more documentation on the url syntax? Is this regex based? that did it! THank you so much!
Aditya Mathur
Aditya Mathur4mo ago
Yup Can you mark this as resolved?
Want results from more Discord servers?
Add your server