reitit

https://cljdoc.org/d/metosin/reitit/ https://github.com/metosin/reitit/
orestis 2020-06-04T11:39:44.047200Z

I’m looking at reitit.frontend.controllers — is there a way to “hang” some data to the match object? Or are the start/stop functions only for side effects?

orestis 2020-06-04T11:45:12.047600Z

Looking at the code, it seems not.

2020-06-04T12:05:35.048500Z

I’d look at the identity function, it takes a match and returns an arbitrary value, so a good place to hook in some extra data before it gets passed to start/stop

juhoteperi 2020-06-04T12:09:18.049800Z

Apply-controllers is also just a 50 lines of code and you are calling it from your route change handler, you could just call your own code from the same place, no need to use controllers for this.

orestis 2020-06-04T12:17:18.050400Z

@juhoteperi yeah this is what I ended up doing. Literally 2 lines of code 😄

👍 1
Tanel 2020-06-04T18:07:26.052Z

Is there a way to have optional query parameters when coercing with clojure.spec? I have the following, but the request fails if parameters are missing:

{:get {:parameters {:query {:limit int?
                            :offset int?}}
Edit: Nevermind, I solved it by using your `spec-tools.data-spec/opt`