Fork me on GitHub
#reitit
<
2020-05-15
>
FiVo14:05:58

Hey, I have asked before but haven't found a solution. Is it possible to use reitit with hash-fragments in the frontend? So that [:a {:href "/sub-page2#foo}] navigates to the correct subsection.

ikitommi14:05:08

@rextruong tested and that works ok:

(defn wrap-test [handler]
  (fn [req] (handler req)))

((ring/ring-handler
   (ring/router
     ["/ping" {:get (constantly {:status 200, :body "pong"})}])
   nil
   {:middleware [#(wrap-test %)]})
 {:request-method :get
  :uri "/ping"})
; => {:status 200, :body "pong"}

ikitommi14:05:20

ring uses 2 arities, sync (1) and async (3), if your ring-adapter is configured for async, all middleware are also required to have 3 arity. If that’s not the reason, I would just restart the repl. Could be some dirty state in mount.