hash-route v2.0.3
A router tool based on decorator and hash string.
Usage
You can register the route by @route
decorator.
Note: You can put string literal at the method name position in es2015.
const route dispatch = { } @route '#' location @route '#projects' @route '#projects/:project' params @route '*' ...
With the above example, each time the hash string changed the registered routes are compared with location.hash
and if it matches, the corresponding route (method) is invoked.
The express style patterns are available as route paths. This library uses path-to-regexp under the hood. See its document for available patterns.
Install
npm install hash-route
License
MIT