remiddy
[![Build Status](https://travis-ci.org/i-am-kenny/remiddy.svg?branch=master)](https://travis-ci.org/i-am-kenny/remiddy) [![codecov](https://codecov.io/gh/i-am-kenny/remiddy/branch/master/graph/badge.svg)](https://codecov.io/gh/i-am-kenny/remiddy) [![Known
Last updated 2 years ago by dotkenny .
MIT · Original npm · Tarball · package.json
$ cnpm install remiddy 
SYNC missed versions from official npm registry.

remiddy

Build Status codecov Known Vulnerabilities

Middleware for Remiddy. Inspired by the example middleware and projects like Recompose.

Better documentation is coming soon...

Middleware

General

  • withEnvironmentVariable
  • withSSM

API

Kinesis

  • withKinesisRecordFilter
  • withKinesisRecordMap
  • withKinesisStreamRecordCount

DynamoDb Stream

  • withDynamoDbDeleteRecordFilter
  • withDynamoDbInsertRecordFilter
  • withDynamoDbRecordFilter
  • withDynamoDbUpdateRecordFilter
  • withDynamodbUpsertRecordFilter
  • withUnmarshalledDynamoDbRecords

Examples

withAwsRegion

Adds the context.invokedFunctionArn to the response headers as x-aws-region.

middy(...).use(withAwsRegion());
middy(...).use(withAwsRegion('x-aws-region')); // optionally rename the header

withDefaultHttpEvent

Defaults queryStringParameters and pathParameters to {} if undefined or null;

middy(...).use(withDefaultHttpEvent());

withFunctionVersion

Adds the Lambda function version to the response headers as x-aws-function-version.

middy(...).use(withFunctionVersion());
middy(...).use(withFunctionVersion('x-aws-function-version')); // optionally rename the header

withHttpResponseHeader

Adds custom HTTP repsonse headers.

middy(...).use(withResponseHeader({
  'Access-Control-Allow-Origin': '*'
}));

middy(...).use(withResponseHeader((handler) => ({
  'x-custom-header': handler.event.value
})));

withJoiValidation

Allows validation (and conversion) of any event property; such as event.body, pathParameters, etc...

middy(...).use(withJoiValidation({
  queryStringParameters: {
    name: Joi.string().required(),
    year: Joi.number().required()
  }
});

withRequestId

Adds the context.awsRequestId to the response headers as x-aws-request-id.

middy(...).use(withRequestId());
middy(...).use(withRequestId('x-aws-request-id')); // optionally rename the header

withResponseTime

Adds "response-time" (ms) to the response headers as x-aws-response-time. Does not include the coldstart time, and is likely not accurate.

middy(...).use(withResponseTime());
middy(...).use(withResponseTime('x-aws-response-time')); // optionally rename the header

withWarmupHeader

Allows x-aws-warmup to be passed via request headers to immediately end execution with a 204 status.

middy(...).use(withWarmupHeader());
middy(...).use(withWarmupHeader('x-aws-warmup')); // optionally rename the header

Current Tags

  • 0.0.8                                ...           latest (2 years ago)

8 Versions

  • 0.0.7                                ...           2 years ago
  • 0.0.8                                ...           2 years ago
  • 0.0.6                                ...           2 years ago
  • 0.0.5                                ...           2 years ago
  • 0.0.4                                ...           2 years ago
  • 0.0.3                                ...           2 years ago
  • 0.0.2                                ...           2 years ago
  • 0.0.1                                ...           2 years ago
Maintainers (1)
Downloads
Today 0
This Week 16
This Month 17
Last Day 16
Last Week 1
Last Month 1
Dependencies (2)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |