serverless-plugin-api-gateway-integrations
TypeScript icon, indicating that this package has built-in type declarations

0.0.8 • Public • Published

serverless-plugin-api-gateway-integrations

License: MIT CircleCI

Note: If you're missing any capability please open an issue/feature request :)

Introduction

I wrote this plugin since I wanted to wrap my lambda with an SQS queue.
I found that there is a lot of boilerplate when writing SQS API Gateway integration hence this plugin.
I'm open to adding more integrations and configuration options :)

Installation

Install with yarn

yarn add serverless-plugin-api-gateway-integrations --dev

or npm

npm install serverless-plugin-api-gateway-integrations --save-dev

Usage

In your serverless.yml under plugins add

plugins:
  - serverless-plugin-api-gateway-integrations

Under custom add:

custom:
  apiGatewayIntegrations:
    { type: sqs, name: 'queue' } # only sqs is supported at the moment 

You can reference the created queues' ARNs by using Pascal case naming:

functions:
  consumer:
    events:
      sqs:
          arn: !GetAtt ApiGatewayIntegrationSqsQueue.Arn
 
  errorHandler:
    events:
      sqs:
          arn: !GetAtt ApiGatewayIntegrationSqsQueueDlq.Arn

The plugin will create an API gateway (or use the existing default one if exists), and add all the necessary resources, methods and roles (with cors support).

Then you can do:

curl -d '{"message":"Hello World!"}' -H "Content-Type: application/json" -X POST https://*************.execute-api.us-east-1.amazonaws.com/dev/queue

Package Sidebar

Install

npm i serverless-plugin-api-gateway-integrations

Weekly Downloads

1

Version

0.0.8

License

MIT

Unpacked Size

24.8 kB

Total Files

9

Last publish

Collaborators

  • erezro