holy-lambda

Karol W贸jcik 2021-11-03T08:51:23.057400Z

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) {})

Karol W贸jcik 2021-11-03T08:52:23.057500Z

@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? 馃檹

steveb8n 2021-11-03T08:53:15.057800Z

tbh I鈥檓 a Pedestal user so I won鈥檛 use the Ring adapter

Karol W贸jcik 2021-11-03T08:53:31.058Z

Isn't pedestal somewhat compatible with Ring?

steveb8n 2021-11-03T08:53:47.058200Z

but for a local server I would consider it

Karol W贸jcik 2021-11-03T08:54:14.058400Z

Actually having an adapter for Pedestal would be cool

steveb8n 2021-11-03T08:54:21.058600Z

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

steveb8n 2021-11-03T08:54:51.058800Z

I agree. Pedestal variant would be coo;

steveb8n 2021-11-03T08:54:54.059Z

cool

Karol W贸jcik 2021-11-03T08:55:11.059200Z

Do you have experience in shaping correct request for pedestal?

steveb8n 2021-11-03T08:55:35.059400Z

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

Karol W贸jcik 2021-11-03T08:56:02.059900Z

Wondering how much would have to change 馃槃

Karol W贸jcik 2021-11-03T08:57:01.060100Z

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

steveb8n 2021-11-03T08:57:17.060300Z

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

steveb8n 2021-11-03T08:57:37.060500Z

without needing the full pedestal stack.

steveb8n 2021-11-03T08:58:17.060700Z

although Pedestal with Jetty makes it pretty simple

Karol W贸jcik 2021-11-03T08:58:37.060900Z

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