@chialab/router

A simple agnostic router for Web Apps.

Stats

stars 🌟issues ⚠️updated 🛠created 🐣size 🏋️‍♀️
22Jun 10, 2021May 20, 2016Minified + gzip package size for @chialab/router in KB

Readme

Router

A simple agnostic Router for Web Apps.

Travis Code coverage NPM

Sauce Test Status

Install

$ npm i @chialab/router --save

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();

If you find any bugs or have a feature request, please open an issue on github!

The npm package download data comes from npm's download counts api and package details come from npms.io.