Make a userpage with FlowRouter


#1

Hi. I’ve been working with FlowRouter and I’m working on a “userpage” that will show the the posts and comments created by a specific user when the user’s name is clicked.

I tried implementing the techniques but I was unsucesdful. Can you help me?
This is what I’ve done so far;

I created a “userpage” template.
And then I made a route;

FlowRouter.route('/arguement/:username', {  
       name: 'userpage',
       action: function(params) {  
       BlazeLayout.render("layout", {main: "userpage"});
       }
       });

And then I made a helper for the template;

           Template.userpage.helpers({

             argument: function() {
            // Finds a post with the _id value set to the _id paramater from FlowRouter's URL.
             return Posts.find({ username: FlowRouter.getParam('username') });
                  }
                 });

The posts are iterated on the template like this;

            {#each argument} ... {/each}

And the URL to the template is presented in the html as this;

            {{pathFor 'userpage'}}/{{username}}

After all this, the “userpage” template appears blank when visited. The appropriate username does appear in the URL but only the layout shows up.

I’m wondering if there’s a mistake here.

I implore your generous continued assistance. After a few examples, I will be more experienced to tackle similar problems.

Thanks.