meteor Routing With FlowRouter


FlowRouter is more modular compared to Iron Router.

Install FlowRouter

meteor add kadira:flow-router

Rendering a template

In particular, you must manually add a layout rendering package to link with your rendering engine:

Then you can render through dynamic templating (in the case of Blaze):

<template name="mainLayout">
  {{> Template.dynamic template=area}}
FlowRouter.route('/blog/:postId', {
  action: function (params) {
    BlazeLayout.render("mainLayout", {
      area: "blog"

Rendering a template with parameters and/or query

The parameters are specified on the route, like with Iron Router:

FlowRouter.route("/blog/:catId/:postId", {
  name: "blogPostRoute",
  action: function (params) {

But the parameters are not passed as data context to the child template. Instead, the child template must read them:

// url: /blog/travel/france?showcomments=yes
var catId = FlowRouter.getParam("catId"); // returns "travel"
var postId = FlowRouter.getParam("postId"); // returns "france"

var color = FlowRouter.getQueryParam("showcomments"); // returns "yes"