reitit

https://cljdoc.org/d/metosin/reitit/ https://github.com/metosin/reitit/
nando 2020-08-17T12:31:19.044100Z

I'm a beginner at Clojure and have started developing a ring app using Compojure as a learning tool. I've also been looking at Reitit, and get the general impression that dealing with middleware is easier, perhaps much easier, in Reitit. Is my impression correct?

👌 1
nando 2020-08-17T12:41:21.047500Z

I find a variety of examples how to sequentially wrap middleware around the request, using nested function calls, the threading macro, ordering, and the selection of middleware applied to the request, is important for various cases.

nando 2020-08-17T12:42:34.047900Z

This seems confusing to deal with in compojure.

ikitommi 2020-08-17T12:44:35.050600Z

in reitit, the :middleware holds a vector of middleware or data to create middleware. The chain is basically a comp from the chain.

nando 2020-08-17T12:48:02.052400Z

@ikitommi That seems easier to deal with than wrapped functional calls to me, as a beginner. Would you agree?

2020-08-17T12:54:28.055200Z

I definitely like it better.

👍 1
nando 2020-08-17T12:57:45.058500Z

The general advice for a beginner seems to be to start with compojure, but I'm having all sorts of issues getting middleware working with compojure and notice that many others do as well. I'm wondering if reitit users experience the same.

2020-08-17T13:02:56.060400Z

One really cool thing about reitit middleware handling is that if you include [reitit.ring.middleware.dev :as reitit-dev] and then set :reitit.middleware/transform reitit-dev/print-request-diffs in the options to reitit.ring/router, you get an awesome amount of debugging info for tracking down middleware problems.

nando 2020-08-17T13:06:46.061600Z

@manutter51 Thanks for the tip. That sounds very useful.