Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upNested route issue with radix-router #2006
Comments
|
Thank you @nsainaney. Definitely looks like a bug. I guess this would be another reason to have our own internal Radix-tree router implementation (the other one would be Deno compatibility). |
Steps to reproduce
I believe I found out what causes #670
/organizations/organizations/:orgId/people/organizations,/organizations/xyz,/organizations/xyz/peopleeverything works fine/organizations/xyz/people- the request goes to/organizations/xyzand not/organizations/xyz/peopleIn the radix-router,
function _findNode(path, rootNode)loops through all the nodes in the router. In the above, the nodes tree looks like so:+-- organization
|----+-- :__id
|----+-- :orgId
|--------+-- people
When doing a lookup,
/organizations/xyz/people, radix matches the__idnode (even though it should match:orgId/peopleExpected behavior
The router should match the
:orgId/peoplenode and not the:__idnodeSolutions
Create the following routes instead:
which creates a proper node tree within radix:
+-- organization
|---+-- :__id
|-------+-- people
The danger here is that :__id is undocumented and may change in the future. Is this ok? The above does not affect the REST transport, just socketio.