3.0.2 • Published 2 years ago

@chialab/router v3.0.2

Weekly downloads
48
License
MIT
Repository
github
Last release
2 years ago

Install

$ npm install @chialab/router
# or
$ yarn add @chialab/router

Use via cdn:

<script type="text/javascript" src="https://unpkg.com/@chialab/router-js"></script>

Example

import Router from '@chialab/router';

const appRouter = new Router();
appRouter.on('/user/:username', function(id) {
    fetchUserById(id);
});
appRouter.on('/posts/:id', function(id) {
    fetchPostById(id);
});
appRouter.on('/posts', function() {
    listPosts();
});
appRouter.on('*', function() {
    page404();
});
appRouter.start();

Development

Build status codecov

Requirements

In order to build and test Router, the following requirements are needed:

Build the project

Install the dependencies and run the build script:

$ yarn install
$ yarn build

This will generate the UMD and ESM bundles in the dist folder, as well as the declaration file.

Test the project

Run the test script:

$ yarn test

License

Router is released under the MIT license.

3.0.2

2 years ago

3.0.1

4 years ago

3.0.0

6 years ago

3.0.0-alpha.1

6 years ago

1.0.1

7 years ago

1.0.0

7 years ago