router5
  • Read Me
  • Introduction
    • Why router5?
    • Getting Started
    • Ecosystem
    • Core concepts
    • Transition phase
  • Guides
    • Defining routes
    • Path Syntax
    • Router options
    • Navigating
    • In the browser
    • Observing state
  • Integration
    • With React
    • With Redux
  • Advanced
    • Plugins
    • Middleware
    • Preventing navigation
    • Errors and redirections
    • Dependency injection
    • Loading async data
    • Universal routing
    • Listeners plugin
  • API Reference
  • Migration
    • Migrating from 7.x to 8.x
    • Migrating from 6.x to 7.x
    • Migrating from 5.x to 6.x
    • Migrating from 4.x to 5.x
    • Migrating from 3.x to 4.x
    • Migrating from 2.x to 3.x
    • Migrating from 1.x to 2.x
    • Migrating from 0.x to 1.x
Powered by GitBook
On this page
  • Installation
  • Include router5 in your application
  • ES2015 syntax
  • CommonJS syntax
  • UMD
  1. Introduction

Getting Started

PreviousWhy router5?NextEcosystem

Last updated 6 years ago

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 .

Installation

# yarn
yarn add router5
# npm
npm install router5

Include router5 in your application

ES2015 syntax

// ES2015+
import createRouter from 'router5';

import browserPlugin from 'router5-plugin-browser';
import persistentParamsPlugin from 'router5-plugin-persistent-params';

CommonJS syntax

var createRouter = require('router5').default;
var browserPlugin = require('router5-plugin-browser');
var persistentParamsPlugin = require('router5-plugin-persistent-params');

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.

github