bidi
bidi copied to clipboard
URL Prefix like "#/my-route"
Coming from Secretary, I'd like to use a prefix for my routing for development. Is this possible with Bidi?
Yes, bidi routes are fully nestable. Is that what you mean?
@malcolmsparks I'm upgrading from 1.2x and it seems that using "#/" no longer works. (At least in cljs)
You can try with this simple exemple:
;; same example as the readme, but with '#'
(def route ["#/index.html" :index])
;; we get the correct result with 'path-for'
(bidi/path-for route :index)
;;=> "#/index.html"
;; however, 'match-route' returns nil
(bidi/match-route route "#/index.html")
Thanks for this - I shall look into it today
On 26 February 2016 at 23:22, Frozenlock [email protected] wrote:
@malcolmsparks https://github.com/malcolmsparks I'm upgrading from 1.2 and it seems that using "#/" no longer works. (At least in cljs)
You can try with this simple exemple:
;; same example as the readme, but with '#' (def route ["#/index.html" :index])
;; we get the correct result with 'path-for' (bidi/path-for route :index);;=> "#/index.html" ;; however, 'match-route' returns nil
(bidi/match-route route "#/index.html")
— Reply to this email directly or view it on GitHub https://github.com/juxt/bidi/issues/120#issuecomment-189523397.
I also tested in Clojure and I get the same result.
Any update?
Coding around is quite trivial, but I'd still like to know if this will be permanent.
@malcolmsparks any update on this?
Check out the source code of bidi.router.cljs - it is meant to be used for client side urls and has a minimalist working code snippet in the doc string. Once you set it up you can have routes as in Secretary, i.e. prefixed with #, but you can still use your bidi routes.