I can not manage to create the routes to show a single post with flowrouter and blaze in Meteor.
This is what I have so far which I am sure its mostly wrong!
publications.js
Meteor.publish('singlePost', function (postId) {
return Posts.find({ _id: postId });
});
Router.js
FlowRouter.route("/posts/:_id", {
name: "postPage",
subscriptions: function (params, queryParams) {
this.register('postPage', Meteor.subscribe('singlePost'));
},
action: function(params, queryParams) {
BlazeLayout.render("nav", {yield: "postPage"} )
}
});
singlePost.JS
Template.postPage.helpers({
thisPost: function(){
return Posts.findOne();
}
});
singlePost.html
<template name="postPage">
{{#with thisPost}}
<li>{{title}}</li>
{{/with}}
</template>
I used to do it back then with Iron router but now got confused with Flow router.