api design – REST API path parameter with multiple meanings

I have been in that situation working with node+express, and while you can make both pattern works, the /projects/{id|"tags"} got me into messy a bit of a messy code base, because I wanted to have a middleware running after my controler and ended up having both route being taken.

I ended up haveing something like:


So I could avoid routing bug

In the end it depends on your framework router and how you organise your code.
Another way I could have solved this is to just end() my request in my controler and declaring the tags route before the id one so it hit first, but other framework may have different internal behavior.