bidi icon indicating copy to clipboard operation
bidi copied to clipboard

URL Prefix like "#/my-route"

Open theronic opened this issue 8 years ago • 7 comments

Coming from Secretary, I'd like to use a prefix for my routing for development. Is this possible with Bidi?

theronic avatar Feb 05 '16 12:02 theronic

Yes, bidi routes are fully nestable. Is that what you mean?

malcolmsparks avatar Feb 05 '16 12:02 malcolmsparks

@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")

Frozenlock avatar Feb 26 '16 23:02 Frozenlock

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.

malcolmsparks avatar Feb 29 '16 10:02 malcolmsparks

I also tested in Clojure and I get the same result.

Frozenlock avatar Mar 04 '16 02:03 Frozenlock

Any update?

Coding around is quite trivial, but I'd still like to know if this will be permanent.

Frozenlock avatar Apr 14 '16 16:04 Frozenlock

@malcolmsparks any update on this?

burn2delete avatar Jul 13 '16 20:07 burn2delete

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.

ignorabilis avatar Sep 18 '16 09:09 ignorabilis