Search code examples
meteoriron-router

What is the difference between these two forms of Iron Router's Router.route?


I've seen two forms that basically seem to do the same thing, given a template called 'index'. What are the differences between them?

First:

Router.route('index', {
  path: '/'
});

Second:

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

Solution

  • In this case there's probably no difference. It's two ways to do the same thing. It's a question of syntax. The first syntax is clearly simpler in this case though.

    There might be other cases where there are certain things you can do with one syntax that you can't do with the other syntax, but I don't remember an example off the top of my head.