Liking cljdoc? Tell your friends :D

Respo Router

This project is in early stage...

Demo http://repo.respo.site/router/

Usage

Clojars Project

[respo/router "0.2.2"]
[respo-router.util.listener :refer [listen! parse-address]]
[respo-router.core :refer [render-url!]]
; router rules
(def dict
 {"home" [], "room" ["room-id"], "team" ["team-id"], "search" []})

; :hash | :history
(def mode :history)

; listen to router and dispatch actions
(listen! dict dispatch! mode)

; /a/b?c=d
(parse-address address dict)

; render url
(add-watch store-ref :changes
  (fn [] (render-url! (:router @store-ref) dict mode)))

Special routes

  • '/' which is identical to '/home'
  • 404

Develop

yarn watch
# another terminal
yarn dev
# open http://localhost:8080

https://github.com/mvc-works/coworkflow

Test

yarn compile-test
node target/test.js

License

MIT

Can you improve this documentation?Edit on GitHub

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close