Skip to content

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

Open
@danbord

Description

@danbord

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions