Socket
Book a DemoInstallSign in
Socket

rack-shelf

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rack-shelf

0.0.2
bundlerRubygems
Version published
Maintainers
1
Created
Source

Rack Shelf

Easily integrate a Rack application into AWS Lambda.

Provides adapters to convert AWS Lambda events to Rack environment requests and Rack responses to AWS Lambda proxy integrations.

Shelf currently works with API Gateway.

Installation

Add to your Gemfile:

gem 'rack-shelf'

or gemspec:

spec.add_dependency 'rack-shelf'

Usage

In your AWS Lambda handler file:

require 'rack/shelf'

class App
  def call
    [200, {}, ['Hello world!']]
  end
end

def handler(event:, context:)
  Rack::Shelf.api_gateway(App.new, event, context)
end

Detailed Explanation

The #api_gateway method indicates the Lambda is expected to be invoked by API Gateway. The method accepts three arguments: the Rack application, the Lambda event, and the Lambda context. Shelf will translate the Lambda information to a Rack environment instance and invoke #call on the application. It then takes the return value of #call (the three-element array) and translates it to a hash. That hash contains the expected keys and values for an AWS Lambda proxy integration.

FAQs

Package last updated on 22 Apr 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.