Fork me on GitHub
#reitit
<
2021-04-22
>
ABeltramo07:04:23

Hello everyone! I'm looking around for a way to expose backend logs (io.pedestal.log -> logback) via REST or HTTP. I stumbled upon http://logback.qos.ch/access.html which seems a good pointer, does anyone have experience on doing this in clj using reitit?

ABeltramo07:04:21

I guess I could just read, parse and return structured data from the logfile itself, I was just looking if there was a better alternative.

Yevgeni Tsodikov07:04:55

Hi, Is it possible to extract a non parameterized part of the route into a parameter? For example, /type_a/hi/:name and /type_b/hi/:name have different handlers, but I’d like to know in the handler if the request came from type_a or type_b without parsing the url

["/v1.0" {:middleware [middleware-a middleware-b middleware-c]}
 ["/type_a" {:swagger {:tags [:type-a]}}
  ["/hi/:name" {:post {:handler hi-for-type-a-handler}}]
  ["/goodbye/:name" {:post {:handler goodbye-for-type-a-handler}}]]
 ["/type_b" {:swagger {:tags [:type-b]}}
  ["/hi/:name" {:post {:handler hi-for-type-b-handler}}]
  ["/goodbye/:name" {:post {:handler goodbye-for-type-b-handler}}]]]

ikitommi08:04:17

@evg.tso you can pull out the routing Match from ring request, I recall via (reitit.ring/get-match request) . It might have the information you need. Currently, there is no way to compile/pre-compute a handler like one can do for middleware, so need to do this at runtime.

🙏 2