serverless/docs/plugins/aws/awsCompileApigEvents.md
Philipp Muens 7311d3c89a Add documentation for awsCompileApigEvents plugin
Fix some minor typos and format issues alongside.
2016-06-15 12:25:44 +02:00

948 B

awsCompileApigEvents

This plugins compiles the functions HTTP endpoint definitions to valid API Gateway CloudFormation resources.

How it works

awsCompileApigEvents hooks into the deploy:compileEvents hook.

It loops over all functions which are defined in serverless.yaml. For each function that has a http_endpoint event defined, an API Gateway REST API will be created.

Furthermore a lambda permission for the current function is created which makes is possible to invoke the function when the endpoint is accessed.

Those two resources are then merged into the serverless.service.resources.aws.Resources section.

Event syntax

To define a HTTP endpoint you need to add a http_endpoint event source to the events section of the serverless.yaml file:

functions:
  create:
    handler: posts.create
    events:
      aws:
        http_endpoint:
          post: posts/create