2.4.7 • Published 9 years ago

hiroshima v2.4.7

Weekly downloads
-
License
MIT
Repository
github
Last release
9 years ago

hiroshima Build Status NPM Version License

Hiroshima is a routing library inspired by the style of the D3.js monks, out of need for a short-term working replacement for the great React Router. It is designed to be simplistic and flexible while keeping the API clean and rigid.

Usage

import {Router} from 'hiroshima';

function routes(router) {
    router.group(App).call(function(router) {
        router.index(Home);

        router.dir('about').index(About);

        router.dir('users').call(function(router) {
            router.index(Users);
            router.param('user_id', /\d+/).index(User);
            router.else(BadUser);
        });

        router.else(NotFound);
    });
}

const router = new Router().call(routes);

router.match('/'); // {components: [App, Home]}
router.match('/about'); // {components: [App, About]}
router.match('/users'); // {components: [App, Users]}
router.match('/users/123'); // {components: [App, User], params: {user_id: '123'}}
router.match('/users/foo'); // {components: [App, BadUser]}
router.match('/foo'); // {components: [App, NotFound]}

Documentation

TODO

2.4.7

9 years ago

2.4.6

9 years ago

2.4.5

9 years ago

2.4.4

9 years ago

2.4.3

9 years ago

2.4.2

9 years ago

2.4.1

9 years ago

2.4.0

9 years ago

2.3.0

9 years ago

2.2.0

10 years ago

2.0.2

10 years ago

2.0.1

10 years ago

2.0.0

10 years ago

1.2.0

10 years ago

1.1.0

10 years ago

1.0.1

10 years ago

1.0.0

10 years ago