Skip to content
dr.dimitru edited this page Nov 14, 2022 · 14 revisions

Client routing for Meteor.js apps

meteor add ostrio:flow-router-extra
import { FlowRouter } from 'meteor/ostrio:flow-router-extra';

// DISABLE QUERY STRING COMPATIBILITY
// WITH OLDER FlowRouter AND Meteor RELEASES
FlowRouter.decodeQueryParamsOnce = true;

FlowRouter.route('/', {
  name: 'index',
  action() {
    // Render a template using Blaze
    this.render('templateName');

    // Can be used with BlazeLayout,
    // and ReactLayout for React-based apps
  }
});

// Create 404 route (catch-all)
FlowRouter.route('*', {
  action() {
    // Show 404 error page using Blaze
    this.render('notFound');

    // Can be used with BlazeLayout,
    // and ReactLayout for React-based apps
  }
});

For the new apps it is recommended to set decodeQueryParamsOnce to true. This flag is here to fix #78. By default it is false due to its historical origin for compatibility purposes.

General tutorials:

Hooks (in execution order):

Helpers:

API:

Related packages:

Support this project:

This project wouldn't be possible without ostr.io.

Using ostr.io you are not only protecting domain names, monitoring websites and servers, using Prerendering for better SEO of your JavaScript website, but support our Open Source activity, and great packages like this one could be available for free.

Clone this wiki locally