Useraccounts and Iron-router route priority


#1

I have a parameterized route that is of the form:

this.route "name",
     path: '/:param'

and I just added the useraccounts package which adds or assumes the usage of a few fixed path routes, like ‘/sign-in’ and and ‘/forgot-password’.

I would have thought that Iron-Router would use the route with associated with an exact match over a parameterized match but it doesn’t seem to do that. Is it possible to have a parameterized root route but defer to hardpaths/fixedpath matches?


#2

It’s a problem with the routes’ definition order.
To my best knowledge IR performs in order tests for matches.

Just make sure your parametric route’s definition comes at last (after every other route definition).

I usually keep a shared file structure like this one:

lib
├── config
│   └── at_config.js
└── router.js

to be sure all UA routes get defined before the others.

…with this very same structure, you could put your definition as the last inside the router.js file.