Fork me on GitHub
Karol Wójcik08:11:23

Idea Now holy-lambda-adapter supports ring style handlers, so that you can use Ring with HL.

(defn ring-handler
  {:status 200
   :headers {}
   :body \"Hello World\"}

(def HttpApiProxyGateway (hlra/wrap-hl-req-res-model ring-handler))

(h/entrypoint [#'HttpApiProxyGateway])
I'm wondering whether adapter should support also a reversed conversion for development. Something like allowing HL handlers run on ring server.
(defn hl-style-handler
  {:statusCode 200
   :headers {}
   :body {:something "something"}

(jetty/run-server (hlra/adapt-to-ring hl-style-handler) {})

Karol Wójcik08:11:23

@U0510KXTU I expect your input here since you already were doing something like this for yourself. Would you use the official library if that would be possible? 🙏


tbh I’m a Pedestal user so I won’t use the Ring adapter

Karol Wójcik08:11:31

Isn't pedestal somewhat compatible with Ring?


but for a local server I would consider it

Karol Wójcik08:11:14

Actually having an adapter for Pedestal would be cool


yes Pedestal can adapt ring middlewares but the request/context shape is different


I agree. Pedestal variant would be coo;

Karol Wójcik08:11:11

Do you have experience in shaping correct request for pedestal?


it’s pretty simple. it’s just a context map with a :request key

Karol Wójcik08:11:02

Wondering how much would have to change 😄

Karol Wójcik08:11:01

Then we would have to reverse the conversion for local server as well, but yeah. I think it's doable


you might be able to just use this lib io.pedestal/pedestal.interceptor


without needing the full pedestal stack.


although Pedestal with Jetty makes it pretty simple

Karol Wójcik08:11:37

Yeah. That would be cool. I would not have to implement interceptors (which are quite hard to implement if you want to be compatible with babashka) 😄