A routing library for Riot.
Why
To make it easier to use Riot in SPA applications, I created this url routing library inspired by the React-Router API.
How?
First you create your riot tags:
Then you add Riot and Riot-Router to your development page:
Add this special tag in your page:
or, if your prefer:
And finally, you declare your routes and initialize your application:
Done!
Installation
npm install riot-router
This library is written with CommonJS modules. If you are using browserify, webpack, or similar, you can consume it like anything else installed from npm.
Advanced examples
var Route = RouterRoute DefaultRoute = RouterDefaultRoute NotFoundRoute = RouterNotFoundRoute RedirectRoute = RouterRedirectRoute; router; // Redirect unlogged users to /login page { try return ; finally if !windowloggedUser && requesturi !== '/login' responseredirectTo = '/login'; }router; riot;routerstart;