Search code examples
meteoriron-router

Meteor: Iron.Router Catch All (Will match the rest of the URI)


Is it possible to define a Iron.Router route with a parameter that will match the rest of the URI?

For example

Router.route('results', {
    path: '/test/:domain'
});

This will match on entries like

  • /test/hello
  • /test/hello.com

What I really need, is to also match on entries such as

  • /test/hello.com/about
  • /test/hello.com/about?param=3

Thoughts?


Solution

  • Figured out how!

    In this case the path will now be

    Router.route('results', {
        path: '/test/(.*)'
    });
    

    To access the trailing info, access the parameter at index 0

    this.params[0]