Isomorphic Router
Tiny, lightweight, simple isomorphic router.
Internally, it uses the same path-matching engine than express
, but it's exposed directly to be usable in an isomorphic context.
Examples
See the test file:
const catchAll = 0;const users = 0;const user1 = 0;const queryFooBar = 0;const hashFoo = 0; const router = ; router;catchAllshouldbe;router;catchAllshouldbe;usersshouldbe;router;catchAllshouldbe;user1shouldbe;router;catchAllshouldbe;user1shouldbe;router;queryFooBarshouldbe;router;queryFooBarshouldbe;router;queryFooBarshouldbe;router;hashFooshouldbe;router;hashFooshouldbe;router;hashFooshouldbe;router;hashFooshouldbe;
Convenience shorthands
// In a node request handlerrouter;
// Typically in a History popState event handler and/or in DOMLoad eventrouter;