Fork me on GitHub
#reitit
<
2020-08-17
>
nando12:08:19

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
nando12:08:21

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.

nando12:08:34

This seems confusing to deal with in compojure.

ikitommi12:08:35

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

nando12:08:02

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

manutter5112:08:28

I definitely like it better.

👍 1
nando12:08:45

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.

manutter5113:08:56

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.

nando13:08:46

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