Getting Started
router5 is available in all major formats: ES6, CommonJS, and UMD. It can be installed using npm or yarn. Alternatively, you can download a specific version from github.

Installation

1
# yarn
2
yarn add router5
3
# npm
4
npm install router5
Copied!

Include router5 in your application

ES2015 syntax

1
// ES2015+
2
import createRouter from 'router5';
3
4
import browserPlugin from 'router5-plugin-browser';
5
import persistentParamsPlugin from 'router5-plugin-persistent-params';
Copied!

CommonJS syntax

1
var createRouter = require('router5').default;
2
var browserPlugin = require('router5-plugin-browser');
3
var persistentParamsPlugin = require('router5-plugin-persistent-params');
Copied!

UMD

Various UMD bundles are accessible under /dist/umd: you should use them for AMD or global. The router5 bundle contains all router5 dependencies (route-node and path-parser), but doesn't contain plugins.
Last modified 3yr ago