0.6.2 • Published 8 years ago
chialab-router v0.6.2
Router
A simple agnostic Router for Web Apps.
Install
$ npm i chialab-router --save
$ bower i chialab-router --save
Example
var 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();