Skip to content

Router matching multiple routes to controllers #640

@lucaswxp

Description

@lucaswxp

I have the following routes defined:

exports.routes = function (map) {
    map.all('admin/:controller/:action');
    map.all('admin/:controller/:action/:id');
    map.all(':controller/:action');
    map.all(':controller/:action/:id');
};

When I visit /admin/mycontroller/index, I see in my console that compound is trying to access both:

Params: {"controller":"mycontroller","action":"index"} // this is correct
Params: {"controller":"admin","action":"mycontroller","id":"index"}

But I was expecting only the first to be routed. Is this a bug? Yes, both routes are valid, but only one is supposed to be executed, not every matching route.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions