holy-lambda 2021-11-03

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

(defn ring-handler
  [request]
  {: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
  [request]
  {:statusCode 200
   :headers {}
   :body {:something "something"}

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

@steveb8n 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鈥檓 a Pedestal user so I won鈥檛 use the Ring adapter

Isn't pedestal somewhat compatible with Ring?

but for a local server I would consider it

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;

Do you have experience in shaping correct request for pedestal?

it鈥檚 pretty simple. it鈥檚 just a context map with a :request key

Wondering how much would have to change 馃槃

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

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) 馃槃