Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

app.http controllers evaluation is in alphabetical order, causing problem with optional params #300

Open
danbord opened this issue Sep 25, 2024 · 0 comments

Comments

@danbord
Copy link

danbord commented Sep 25, 2024

Given the following controller declarations:

app.http("accounts", {...,  route: "accounts/{accountId?}/{action?}"})
app.http("products", {...,  route: "accounts/{accountId?}/products/{productId?}"})

If we GET from the following url : /api/accounts/12345/products/ it will end up in the accounts controller with param action="products"

Expected behavior

When evaluating a route, I think the static params should have precedence over the optional ones. Now they are evaluated in alphabetical order (which seems nonsense)

Known workarounds

If we rename the accounts controller "zaccount" (to put after the "products" alphabetical position when evaluating the route). Then its gonna be evaluated first. And both controllers works as planned.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant