URL Router
Match and destructure URLs templates:
import { Router } from "@dashkite/url-router"
router = Router.create()
router.add
template: "/blog/posts/{key}"
data: pages.view
router.add
template: "/blog/posts/{key}?{token}"
data: pages.edit
match = router.match "/blog/posts/my-first-post?token=miukhuJIguMjq5rXZzslww"
assert.equal true, match?
assert.equal match.data, pages.edit
assert.deepEqual match.bindings,
key: "my-first-post"
token: "miukhuJIguMjq5rXZzslww"
Install
npm i @dashkite/url-router