Skip to content

theburningmonk/lambda-protobuf-demo

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

lambda-protobuf-demo

Demo using API Gateway and Lambda with Protocol Buffer.

In this demo you'll find 3 handlers:

  • json - always return response in JSON
  • proto - always return response in protocol buffer format, you need to set the Accept header to application/x-protobuf for this to work otherwise API Gateway just returns the base64 string instead
  • contentNegotiated - uses the Accept header to decide whether to return JSON or protocol buffer, and return 406 Not Acceptable if the Accept header is neither application/json nor application/x-protobuf

For more details, please read this blog post.

Deployment

If you're on Linux, run ./deploy.sh.

If you're not on Linux, run docker-compose up.

Why use docker for deployment? Because the protobufjs library used to encode Protocol Buffer messages has a dependency that is distributed as a native binary. So in order to get the right version you need to run grab the dependency on a Linux system, docker provides a nice abstraction to do that.

About

Demo using API Gateway and Lambda with Protocol Buffer

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published