Search code examples
javascriptmeteoriron-router

iron router only works with one route


I'm trying to have more than one page on my meteor application, I'm running meteor 1.3.1 and the latest iron router.

This is my main.js file.

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

This is my main.html file

<template name="home">
    <h1>Hello there !</h1>
</template>
<template name="about">
    <h1>this is an about page!</h1>
</template>
<template name="register">
    <h2>Register</h2>
</template>

Now if I navigate to http://localhost:3000/home I can see hello there!

But if I navigate to http://localhost:3000/register I see Oops, looks like there's no route on the client or the server for url: "http://localhost:3000/register."

However if I switch the position of routes in the js file to this:

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

then the register page works and the home page doesn't.


Solution

  • so it turns out that it didn't work because i was using chrome canary (experimental version of chrome), upon using google chrome it worked fine.