Skip to content

Latest commit

 

History

History
36 lines (29 loc) · 1.04 KB

route.md

File metadata and controls

36 lines (29 loc) · 1.04 KB

route method

.route(path, options)

  • path {String} - Path with placeholders
  • options {Object}
  • options.name {String} - Route's name
  • options[prop-name] {Any} - [Optional] Any property which will be available inside route call
  • options[hook-name] {Function} - [Optional] See all available hooks
  • Returns {Route}
import { FlowRouter } from 'meteor/ostrio:flow-router-extra';

FlowRouter.route('/blog/:cat/:id', {
  name: 'blogPostRoute'
})

const params = {cat: "meteor", id: "abc"};
const queryParams = {show: "yes", color: "black"};

const path = FlowRouter.path("blogPostRoute", params, queryParams);
console.log(path); // prints "/blog/meteor/abc?show=yes&color=black"

Catch-all route

// Create 404 route (catch-all)
FlowRouter.route('*', {
  action() {
    // Show 404 error page
  }
});

Further reading