Differential / meteor-boilerplate

Boilerplate meteor app - starting point for meteor apps

Home Page:http://github.differential.com/meteor-boilerplate/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

iron-router not working

webstudiopro opened this issue · comments

Hi,

When I try to add a route "bar" to routes.coffee but the router doesn't pick it up and give message:
"Oops, this page can't be found"

No other errors reported in firefox debugger
Meteor release: 0.8.1.1

--> routes.coffee
Router.map ->
@route 'home',
path: '/'

@route 'dashboard',
path: '/dashboard'
onBeforeAction: ->
AccountsEntry.signInRequired(@)
@route 'notFound',
path: '*'
where: 'server'
action: ->
@response.statusCode = 404
@response.end Handlebars.templatesadded

@route 'bar',
path: '/bar'
data: ->
Meteor.user()
onBeforeAction: ->
AccountsEntry.signInRequired(@)

--> /client/views/bar/bar.html

<p">Test template bar


Any ideas? Got stuck here !
thx
Fret Benny

You need to change the order. Iron router goes through all defined routes and picks the first matching. Since the notFound is defined before the bar, it first matches the notFound and never reaches your barroute.

Thx udondan !
Beginners mistake -:)