The <wc-router>
element provides super fast and flexible routing inspired by Express.
<wc-router params="{{params}}" use-hash>
<div route="(home)?">Home</div>
<div route="blog/:author/:id">Named parameters: [[params.id]], [[params.author]].</div>
<div route="view/(.*)">Unnamed parameters: [[params.0]]</div>
<div route="**">Page not found.</div>
</wc-router>
- It can extract named and unnamed route paramaters
- It can display the selected content
- It can import custom elements on selection
- It can accept a route object or route-path string
- It can respond to URL hash changes
This project requires npm and bower to be installed.
$ npm install && bower update
Polyserve the web component
$ npm start
default port is 9099
Build a client version of pathToRegexp.js
using browserify.
$ npm run build
Run tests from console/terminal
$ npm test
Run tests in browser with locally hosted content
http://localhost:9099/test/index.html
- Improve demo page with more features & iron demo helpers.