[SOLVED] FlowRouter Username Slug Using React?

Morning all!

I maybe wrong but FlowRouter, FR, seems to be weak in its documentation or…it just cant do what I want?

The typical Iron Router:

// from Discover Meteor Book
Router.route('/', {name: 'postsList'});
Router.route('/posts/:_id', {
  name: 'postPage',
// I could also say: return Meteor.user().username
  data: function() { return Posts.findOne(this.params._id); }

Basically I need a slug:

FlowRouter.route("/u/:username/", {

Is this possible with FR? How to?

This is the way I do it (instead of id you can get username)

FlowRouter.route('/posts/:id', {
	name: "postPage",
	action: function(params, queryParams) {
			BlazeLayout.render("nav", {yield: "postPage"})

And then add the flow-router-helpers package and subscribe to the post with

Template.postPage.onCreated(function() {
// Subscribe only the relevant subscription to this page
var self = this;
self.autorun(function() { // Stops all current subscriptions
var postId = FlowRouter.getParam('id'); // Get the collection id from the route parameter
self.subscribe('postPage', postId); // Subscribe to the single entry in the collection with the route params id

and then on the helper to get the details of this specific post:

post: function() {
  var postId = FlowRouter.getParam('id');
  var thisPostDetails = Spots.find({ // Get the selected entry data from the collection with the given id.
  id: postId
  }) || {};
  return thisPostDetails;


My bad. I’m using React :wink: So that won’t work for me.

My router layout is like this:

FlowRouter.route("/", {
  action() {
    mount(Layout, {
        content: (<Welcome name="arunoda"/>)
React is the same way/
FlowRouter.route("/:username", {
  action(params, queryParams) {
    mount(Layout, {
        content: (<Welcome name={params.username}/>)

//or get params inside components
FlowRouter.getParam('username') // it can reactive inside getMeteorData()

Yes I’ve just figured it out but thanks for the reply.