Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/erezrokah/serverless-plugin-api-gateway-integrations
https://github.com/erezrokah/serverless-plugin-api-gateway-integrations
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/erezrokah/serverless-plugin-api-gateway-integrations
- Owner: erezrokah
- License: mit
- Created: 2019-07-21T16:09:23.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2024-04-08T03:26:07.000Z (9 months ago)
- Last Synced: 2024-04-09T03:36:41.913Z (9 months ago)
- Language: TypeScript
- Size: 2.35 MB
- Stars: 3
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# serverless-plugin-api-gateway-integrations
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![CircleCI](https://circleci.com/gh/erezrokah/serverless-plugin-api-gateway-integrations.svg?style=svg)](https://circleci.com/gh/erezrokah/serverless-plugin-api-gateway-integrations)> 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](https://github.com/yarnpkg/yarn)
```bash
yarn add serverless-plugin-api-gateway-integrations --dev
```or [npm](https://www.npmjs.com/)
```bash
npm install serverless-plugin-api-gateway-integrations --save-dev
```## Usage
In your `serverless.yml` under `plugins` add
```yaml
plugins:
- serverless-plugin-api-gateway-integrations
```Under `custom` add:
```yaml
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:
```yaml
functions:
consumer:
events:
- sqs:
arn: !GetAtt ApiGatewayIntegrationSqsQueue.ArnerrorHandler:
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:
```bash
curl -d '{"message":"Hello World!"}' -H "Content-Type: application/json" -X POST https://*************.execute-api.us-east-1.amazonaws.com/dev/queue
```