Skip to content

Instantly share code, notes, and snippets.

@OneMuppet
Last active September 8, 2020 04:53
Show Gist options
  • Save OneMuppet/067f47e1ec4cb2ca40884be1cf7285f4 to your computer and use it in GitHub Desktop.
Save OneMuppet/067f47e1ec4cb2ca40884be1cf7285f4 to your computer and use it in GitHub Desktop.
AWS API Gateway content compression
service:
name: compress-content-tutorial
plugins:
- serverless-api-compression
- serverless-webpack
- serverless-offline
provider:
name: aws
runtime: nodejs8.10
stage: test
region: eu-west-1
environment: ${file(env.yml):${self:custom.stage}}
deploymentBucket: aws-account-id.serverless.deploys
stackTags: ${file(tags.yml):${opt:stage}.stack}
iamRoleStatements:
- Effect: Allow
Action: S3:*
Resource: arn:aws:s3:::*
custom:
stage: ${opt:stage, self:provider.stage}
contentEncoding:
contentCompression: 100 # Minimum body size required for compression in bytes
functions:
getPosts:
handler: src/posts/handler.getPosts
memorySize: 1024
timeout: 10
events:
- http:
path: messages
method: get
cors: true
request:
parameters:
paths:
type: false
package:
individually: true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment