Skip to content

An adapter between Ring core request/response model and Holy Lambda. Run Ring applications on AWS Lambda 🔥

License

Notifications You must be signed in to change notification settings

FieryCod/holy-lambda-ring-adapter

Repository files navigation

holy-lambda logo

Rationale

I wanted to create a library that allows to use known Clojure tools to develop API's on AWS Lambda.

A library that

  • prevents AWS to vendor lock you with Lambda,
  • allows for fast feedback loop while developing API locally,
  • implements a full Ring spec,
  • supports serving resources from AWS Lambda,
  • is fast, so that cold starts are minimal

This is why holy-lambda-ring-adapter was released. An adapter is a part of holy-lambda project and is already used in production.

Compatibility

  • AWS ApiGateway Lambda Integration
  • Java Version >= 11 or Babashka >= 0.8.2
  • GraalVM Native Image >= 21.2.0
  • Holy Lambda >= 0.6.0 [all backends: native, babashka, clojure

Usage

  • With plain ring

    (ns core
     (:require
      [fierycod.holy-lambda-ring-adapter.core :as hlra]
      [fierycod.holy-lambda.core :as h])
    
    (defn ring-handler
      [request]
      {:status 200
       :headers {}
       :body \"Hello World\"})
    
    (def HttpApiProxyGateway (hlra/ring<->hl-middleware ring-handler))
    
    (h/entrypoint [#'HttpApiProxyGateway])
  • With Reitit & Muuntaja reitit

    (ns core
     (:require
      [fierycod.holy-lambda-ring-adapter.core :as hlra]
      [fierycod.holy-lambda.core :as h])
    
    (def muuntaja-ring-handler
      (ring/ring-handler
        (ring/router
          routes
          {:data {:muuntaja   instance
                  :coercion   coerction
                  :middleware middlewares}})))
    
    (def HttpApiProxyGateway (hlra/ring<->hl-middleware muuntaja-ring-handler))
    
    (h/entrypoint [#'HttpApiProxyGateway])

Companies & Inviduals using Holy Lambda Ring Adapter?

Documentation

The holy-lambda documentation is available here.

Current Version

Clojars Project

Getting Help

Get help on Slack

License

Copyright © 2021 Karol Wojcik aka Fierycod

Released under the MIT license.

About

An adapter between Ring core request/response model and Holy Lambda. Run Ring applications on AWS Lambda 🔥

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Sponsor this project

 

Packages

No packages published