Search code examples
meteoriron-router

Meteor Iron Router default route notFound


I have created a meteor app using iron router and the default router looks like this

Router.route('/', {
this.render('Ft');
});

However when i load http://localhost:3000/ i constantly get no found and thus the template Ft is not being loaded.

How can i define the default route in my application?.

Secondly,i have a controller function which looks like this

 home: function() {
   this.render('Ft');
  },

How can i define a controller function that can handle / which is lie the index controller function?.


Solution

  • You need to pass an object:

    Router.route('/',{
      name: 'home',
      template: 'Ft',
      controller(){
        /* your controller function. You don't need to render in that controller 
           if you define the template above */
      }
    });