Fork me on GitHub
#reitit
<
2019-12-28
>
ikitommi07:12:16

@dharrigan Have you set the Content-Type header yourself to the response? It’s a indication to Muuntaja that you have already encoded the body and it doesn’t auto-encode it and raw Map is passed to Ring, causing a failure

ikitommi07:12:29

just remove the header if you want Muuntaja to negotiate & auto-encode the response with the user (uses accept and accept-charset headers)

ikitommi07:12:48

malli-coercion module almost done, supports also humanized api-errors.

dharrigan08:12:12

Ah, yes I was setting the header on the response (in the handler function). Let me try to remove it and see what happens 🙂 Thank you! (btw, really enjoying the library!)

👍 4
dharrigan08:12:37

Yup, that worked 🙂 Thanks!

ikitommi08:12:24

@t95371 haven’t seen any finished tutorials but know there are few incubating by different people. Will link the those to README when/if they get done.

ikitommi08:12:41

Quick reitit-coercion benchmarks with different coercion impls (case of two-way json-transformation & validation):

data-specs: 30.0µs
   clojure-spec: 13.0µs
Plumatic Schema:  2.5µs
          malli:  1.2µs

frozar17:12:17

Hello, I'm really new to the usage of reitit, so sorry if my question seems naive. What I want to achieve is the routing against regular expressions. For example, if I build a router as follows:

(def router
  (reitit/router
  [[#"/page.*" :index]]))
I would like to handle any request that match the regex /page.* but reitit doesn't seem to handle this:
svg-ellipse.core> (reitit.core/routes router)
[]
Is there a way to handle regex through reitit? What I really want to achieve is a behavior similar to the website: http://www.scrumy.com/

dharrigan19:12:53

so, things like /page/foobarbaz and /page/wibblewobble would be valid?

frozar19:12:29

In my case, I was thinking that /pagefoobarbaz and /pagewibblewobble should be valid. In what I propose, you can see page as just a prefixe. In my ideal solution, /foobarbaz and /wibblewobble should be valid. On the other hand /foobar/baz should be invalid. The final behavior behind this is, if the submitted url is not associated with an existant project, then a new project have to be generated and associated with this url. If the submitted url is already assigned to a project, then retrieve it.

dharrigan19:12:18

Wildcard routes perhaps?

frozar19:12:23

I'm trying it again, and let you know what's happen, thank you 🙂