Have ideas to improve npm?Join in the discussion! »


0.1.0 • Public • Published

npm version Build Status Coverage Status


Official website: router5.github.io

This library is in release candidate version. Although it is functional, fully tested and stable, API is subject to adjustments whithout notice.

A simple but powerful HTML5 router, based on route-node and path-parser.

What is it?

It is an HTML5 router, using history and organising named routes in a tree. Browser support is limited to modern browsers implementing session history: http://caniuse.com/#search=history.

Router 5 supports use of hash in URL, but session history is still required: deciding to use a hash or not is therefore not a decision based on browser support, but rather a decision based on server capabilities!

It is aimed at applications rendering a tree of components, but can easily be used elsewhere. This router is library and framework agnostic, and makes no asumption on your implementation. It favours convention over configuration, by giving you the means to observe route changes and to react to them. Afterall, why treat route changes any different than data changes?

You can read more about motivations behind it here: Why router5?.

To get started, look here: Get started


  • Use of hash (#)
  • Default start route: a default route to navigate to on load if the current URL doesn't match any route. Similar to $routeProvider.otherwise() in Angular ngRoute module.
  • Start and stop router
  • Nested named routes: routes are identified by names and parameters so you don't have to manipulate URLs directly. Routes can be nested, introducing the notion of route segments.
  • __Route change listeners: listen to any route change, or register listeners for a specific route.
  • Route node change listeners: you can add listeners to be triggered on a specific named route node. They will be triggered if that named route node is the node a component tree needs to be re-rendered from.
  • Segments deactivation: you can register segment components. On a route change, it will ask those components through their canDeactivate method if they allow navigation. Similar to Angular 2 and Aurelia routers.
  • You are in control! You decide what to do on a route change and how to do it.






npm i [email protected]





Last publish


  • avatar