What am i doing wrong with this route

Router.route('/', { name: 'home', controller: HomepostController, waitOn:function () { return Meteor.subscribe('subheader', 'home'), }, data: function() { return Subheader.findOne(category: home); } });

I get this error.

While building the application:
lib/router.js:82:2: Unexpected token } line 82 is just before data: function() { return Subheader.findOne(category: home); }

My WebStorm says there is a syntax error with Subheader.findOne. The correct syntax is Subheader.findOne({category: 'home'});. (Hint: Get some automatic syntax validation).

1 Like

Shouldn’t it be return Subheader.findOne({category: home});?

Also, which is line 82?

sorry just added it is the }, that it does not the one on it’s own line

Notice the comma , after the return statement. Should be nothing or ; if you insist on using semicolons :wink:

try return Meteor.subscribe('subhead', 'home'); (notice ; instead of ,)