0.0.1 • Published 6 years ago

@funcmaticjs/stagevars-plugin v0.0.1

Weekly downloads
2
License
MIT
Repository
github
Last release
6 years ago

stagevars-plugin

Funcmatic middleware that sets API Gateway Stage Variables in ctx.env

Install

$> npm install --save @funcmaticjs/stagevars-plugin

Usage

const StageVarsPlugin = require('@funcmaticjs/stagevars-plugin')
func.use(new StageVarsPlugin())

Any API Gateway Stage Variables will now be available in ctx.env.

Configuration

API Gateway lets you set up a set of variables for each different deployment stage. If you are using API Gateway's Lambda Proxy Integration the value of these variables will show up in the stageVariables field of the AWS event object.

{
  "httpMethod": "GET",
  ...
  "stageVariables": {
    "VAR1": "hello",
    "VAR2": "world  
  }
}

If there are no stage variables in the event, then this plugin will noop.