Search code examples
meteoriron-routerglob

Iron:router "globbing" isn't working


I want to be able to match paths like this: /path/anything/goes/here/and/can/be/an/arbitrarily/long/path.

So I tried all of the following:

Router.route('/path/*', function(){
    this.render('home');
});

I also tried the path: '/path/:something(*)' and I also tried specifying the path in the second argument options object to Router.route: {path: '/path/*', action:myActionFunction} along with an action function. I even tried using Router.map instead of Router.route, as prescribed in both of the following:

https://gentlenode.com/journal/meteor-11-iron-router-cheatsheet/18

http://www.manuel-schoebel.com/blog/iron-router-tutorial

But still, going to the /path/anything/goes/here doesn't work. It takes me to the default iron:router error page:

Oops, looks like there's no route on the client or the server for url: "http... localhost:1710... /path/this/should/work/according/to/the/above/links."

Any help is appreciated, thanks.


Solution

  • Try

    '/(.*)'

    or

    '/path/(.*)'

    if the url really is domain.com/path/

    I serve routes from '/(.*)' via look up on a collection of documents from this.params

    If you need any routes prior to a catchall put the catchall route in a Meteor.startup and have your finely grained defined routes prior in your router file client side.

    Hope this helps you.