troch / route-node

A package to create a tree of named routes
MIT License
20 stars 15 forks source link

feat: clearer support for language prefixes #35

Open KycKyc opened 3 years ago

KycKyc commented 3 years ago

If project have to use subdirectories (lang prefixes), like: example.com/user - for English example.com/de/user - for German example.com/ko/user - for Korean

We will face some problems: if /user node is children of / node as well as children of /ko node. When code will try to find a match for /user by going through / node, it will slice / from /user segment, so at the next iteration code will try to find a match for user instead of /user, thus will return null as result.

So my proposal is to change literally one line of code, this shouldn't break anything, if i understand everything right.