Skip to content

Latest commit

 

History

History

README.md

JS Webhook DynamoDB Allthings-API Boilerplate

Boilerplate AWS Lambda service which is invoked via API Gateway as a Webhook. The Request to the service must include a JSON body with the webhook payload. The webhook retrieves data from DynamoDB based on the JSON payload,modifies/updates the data with the payload, and saves it back to DynamoDB.

Contents

  1. Installation / Setup
  2. Local Development
  3. Testing
  4. Encrypting Secrets
  5. Deployment
    1. Staging
    2. Prerelease
    3. Production

Installation / Setup

Docker needs to be installed (for local DynamoDB). jq is also required for local development.

Local Development

Best practice is to develop locally using a TDD approach. The boilerplate includes sample tests on which you can build, including example of how to mock AWS services.

Start the development environment with:

yarn dev

Try out the webhook with curl:

curl -s \
  -X POST \
  -H "content-type: application/json" \
  -d '{"id":"s1d2f34","foo":"bar"}' \
  http://localhost:3000/webhook | \
  jq

Testing

yarn test

or

yarn watch:test

Encrypting Secrets

Please see the guide/instructions in the Typescript boilerplate.

Deployment

Staging

yarn deploy

Prerelease

npm version prerelease

Production

npm version [major|minor|patch]