nedpals / vex

Easy-to-use, modular web framework built for V
https://nedpals.github.io/vex
MIT License
339 stars 28 forks source link

err: Failed to add route. Reason: Only one wildcard OR param route in a route list is allowed. #63

Closed mikan-sour closed 1 year ago

mikan-sour commented 1 year ago

Hey there.

First off - great work on Vex. I'm really impressed.

My inquiry is - why do we need to have this error thrown? In restful, if I want to have a get request go to /todo/:id and a patch request go to /todo/:id, I think this should be allowed. However, it seems like this is discouraged. The validation will fail as part of the fn add in the router module. This is definitely allowed in other restful frameworks in other languages.

Can you explain why you did it this way and what you suggest as an alternative?

Thank you!

Thank you,

nedpals commented 1 year ago

Hi, this is actually a bug in the router which I have already fixed it in https://github.com/nedpals/vex/commit/7bccd43c6ae8031e74e8aba4db6a77443b4fdb64. Thanks for reporting! 😃

nedpals commented 1 year ago

Can you explain why you did it this way and what you suggest as an alternative?

Just a follow up, this is actually a limitation on the design of the router where you can't register wildcard routes (/foo/*bar) and parameterized routes (/foo/:bar) at the same time on the same parent route for simplicity.