reitit

https://cljdoc.org/d/metosin/reitit/ https://github.com/metosin/reitit/
jtth 2020-04-21T00:09:56.144100Z

If anyone has any ideas about what’s going on in https://clojurians.slack.com/archives/C053AK3F9/p1587420276364400 your help would be much appreciated. (I won’t be able to check this until tomorrow but really any help or ideas or speculations are welcome; I spent way too long on this today and will rewrite this thing in something else if I can’t figure this out soon. It’s a stock luminus template.)

ikitommi 2020-04-21T05:27:50.147500Z

@jaime.sangcap body coercion depends on the content-type. For json, an json-transformer is used. JSON can present numbers, so no string->number is not enabled. For EDN and Transit, no type coercion is applied, as anything can be presented with it. If you want to do string->numbers etc, you can create a custom coercion with different options. Just swap the json-transformer into string-transformer for "application/json" and you are done. Here’s the relevant config: https://github.com/metosin/reitit/blob/master/modules/reitit-spec/src/reitit/coercion/spec.cljc#L76-L81. Hope that helps.

❤️ 2
jaime 2020-04-21T06:05:57.147700Z

I think I need to make custom transformer as mentioned by ikitommi. Thanks!

jaime 2020-04-21T06:07:03.148500Z

@ikitommi Thanks for the reference! I'll look more into custom transformer of spec-tools today

Nassin 2020-04-21T06:22:20.150400Z

What's the reason reitit tries to be compatible with every clojure web abstraction out there? ring/middleware, ring with interceptors, pedestal, how does one pick from the options?

ikitommi 2020-04-21T08:31:10.152800Z

@kaxaw75836 curiosity? It’s kinda “library for creating web-frameworks”. Planned forever to push out a developer-friednly opinionated stack (with good defaults). Currently, just copy&pasting the template from project to another. Here’s a placeholder: https://talvi.io/

👍 1