reitit

https://cljdoc.org/d/metosin/reitit/ https://github.com/metosin/reitit/
ABeltramo 2021-04-22T07:44:23.139900Z

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?

ABeltramo 2021-04-22T07:52:21.141800Z

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 Tsodikov 2021-04-22T07:59:55.144600Z

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}}]]]

ikitommi 2021-04-22T08:28:17.146800Z

@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.

šŸ™ 1