moria
A routing system for Mithril v0.X*.
Mithril has a beautiful lightweight routing paradigm, but as legends recount, sometimes you need to dig deep to get at the good bits: it's difficult to express the routing of a complex application when m.route( rootElement, defaultRoute, routesHash ) can only be invoked once and the routes hash has to be flat.
Moria aims to solve these problems by producing a Mithril-compatible route hash from nested hierarchies.
Features
- Hierarchical route structures
- Route match functions
- Declarative redirects
Install
npm install --save moria
Use
var moria = ; var routeHash = ; m;
* Moria's last functional release was contemporaneous with Mithril v0.1.22, but it should work with any version below v1. It will not work with Mithril v1. Mithril v1 features a new component model which overlaps with Moria in an incompatible way & introduces semantic ambiguities into the routing model (Route Components vs Route Resolvers) which make routing plugins like Moria difficult to apply consistently. ↩︎