reitit

https://cljdoc.org/d/metosin/reitit/ https://github.com/metosin/reitit/
Ronny Li 2020-12-08T01:05:22.392500Z

Hi, I've seen some reitit handlers extract the following keys from request:

{:keys [path-params query-params body-params]}
Yet when I inspect my request map I only see
:query-string
:path-params
:body
Does anyone know the reason for this discrepancy? Am I on the wrong version of reitit? I'm using [metosin/reitit "0.5.10"]

1āœ…
Dave Russell 2020-12-09T15:05:01.396800Z

It's perhaps also worth noting that query-params can come from the https://github.com/ring-clojure/ring/blob/1.7.0/ring-core/src/ring/middleware/params.clj#L48 that does the same. You don't have to use the reitit middlewares, but they are data-driven so they play nicely with the middleware chain.

Dave Russell 2020-12-09T15:07:27.397200Z

It's the same with body-params. We have our own middleware that handles JSON parsing (i.e. we're not using muuntaja for historical reasons), but we inject the data into :body-params so that we can leverage reitit coercion to inspect and coerce the data therein

Dave Russell 2020-12-09T15:07:57.397400Z

It's really up to you!

Steven Deobald 2020-12-08T19:56:44.394100Z

https://github.com/pariyatti/kosa-crux is reitit (though I'm not sure it would qualify as "normal" anything since this is my first time with reitit and a return to clojure on my part after a 5 year hiatus)

v3ga 2020-12-08T20:17:42.395900Z

Thanks. I was looking for something using reitit and pedestal together but this actually is a good project to read over as well. Iā€™m fairly new to clojure so Iā€™m just hunting for projects to skim over.

Steven Deobald 2020-12-08T20:20:24.396100Z

Most welcome. You can maybe bookmark this, as I'm quite literally just getting back to active development today (pandemic travel back to my home country over the past couple months, naturally).

1šŸ‘