What am i doing wrong with this route


#1

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); }
thanks


#2

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).


#3

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

Also, which is line 82?


#4

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


#5

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


#6

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