Fork me on GitHub
Dave Russell16:10:56

Hey folks! Apologies if this has been asked before -- I'm investigating what it would take to port a large compojure app over to reitit. Is there a recommended transition process? Is it possible to move one route at a time? Any pointers would be much appreciated 🙂


I did that migration a while ago, as I recall it was pretty straightforward. The main gotcha is to be aware that compojure middleware runs “upside-down,” i.e. the the last middleware in the list will be the first to process your incoming request, etc, where as reitit middleware runs from top to bottom: first in the list will be the first to process requests. Also, if you require [ :as reitit-dev], and set :reitit.middleware/transform reitit-dev/print-request-diffs in your ring/router options, you’ll get a ton of diagnostic in the REPL that’s very helpful in debugging middleware issues. I keep them in as comments so I can uncomment them any time I need to debug.

Dave Russell18:10:14

Appreciate the response and tips! I think the request-diffs will be very helpful 🙂 I have been playing around and successfully converted a single API endpoint with all our middlewares to reitit, which I think will make this migration very tractable. If we end up going down this path I think I'll do a write-up!


Cool, that sounds like it would be really useful to people.

👍 3

looking forward to the write-up!

bananadance 3