reitit

https://cljdoc.org/d/metosin/reitit/ https://github.com/metosin/reitit/
Spaceman 2020-04-29T05:21:52.261Z

To test my app's routes, I'm using the reitit frontend, push-state function like so:

(rfe/push-state :home)
And my routes are:
(def router
  (reitit/router
   [["/" {:name        :home
          :view        #'home
          :controllers [{:start (fn [_] (rf/dispatch [:page/init-home]))}]}]
    
    ]))
But I get the error:
No protocol method Router.match-by-name defined for type null: 
Why is that and what am I doing wrong?

rschmukler 2020-04-29T15:01:18.262700Z

@pshar10 you probably need to call rfe/start! so that rfe's router atom gets set

Marcus 2020-04-29T19:01:14.263100Z

Does anyone know the best way to debug routes? I.e. I get http 500 but would like to acess a stack trace or someting

2020-04-29T20:14:56.264Z

Check out the second argument to reitit.ring/router. We have the following options at the top of the map:

:exception pretty/exception
     ;; uncomment the next line (and the matching require in `ns`) to get some really pretty diffs around each middleware call
     ;;:reitit.middleware/transform reitit-dev/print-request-diffs

2020-04-29T20:16:08.265100Z

That will print out some extensive debugging information for each request that comes thru (like, a LOT of info--which is why we keep it commented out when we’re not debugging routes 😄 )