iamatypeofwalrus / shim

Licence: MIT License
HTTP Handler shim for Go projects running on AWS Lambda

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to shim

Vandium Node
AWS Lambda framework for building functions using Node.js for API Gateway, IoT applications, and other AWS events.
Stars: ✭ 377 (+489.06%)
Mutual labels:  lambda, aws-lambda, api-gateway
Serverless Sinatra Sample
Demo code for running Ruby Sinatra on AWS Lambda
Stars: ✭ 195 (+204.69%)
Mutual labels:  lambda, aws-lambda, api-gateway
Serverless Express
Run Node.js web applications and APIs using existing application frameworks on AWS #serverless technologies such as Lambda, API Gateway, Lambda@Edge, and ALB.
Stars: ✭ 4,265 (+6564.06%)
Mutual labels:  lambda, aws-lambda, api-gateway
hyperform
⚡ Lightweight serverless framework for NodeJS
Stars: ✭ 156 (+143.75%)
Mutual labels:  lambda, aws-lambda, api-gateway
Serverless Sharp
Serverless image optimizer for S3, Lambda, and Cloudfront
Stars: ✭ 102 (+59.38%)
Mutual labels:  lambda, aws-lambda, api-gateway
Aegis
Serverless Golang deploy tool and framework for AWS Lambda
Stars: ✭ 277 (+332.81%)
Mutual labels:  lambda, aws-lambda, api-gateway
Apilogs
Easy logging and debugging for Amazon API Gateway and AWS Lambda Serverless APIs
Stars: ✭ 216 (+237.5%)
Mutual labels:  lambda, aws-lambda, api-gateway
Zappa
Serverless Python
Stars: ✭ 224 (+250%)
Mutual labels:  lambda, aws-lambda, api-gateway
Up
Up focuses on deploying "vanilla" HTTP servers so there's nothing new to learn, just develop with your favorite existing frameworks such as Express, Koa, Django, Golang net/http or others.
Stars: ✭ 8,439 (+13085.94%)
Mutual labels:  lambda, aws-lambda, api-gateway
Serverless Es Logs
A Serverless plugin to transport logs to ElasticSearch
Stars: ✭ 51 (-20.31%)
Mutual labels:  lambda, aws-lambda, api-gateway
super-serverless-sample
Backend serverless que simula o sistema de votação do BBB
Stars: ✭ 30 (-53.12%)
Mutual labels:  lambda, aws-lambda, api-gateway
Serverless Next.js
⚡ Deploy your Next.js apps on AWS Lambda@Edge via Serverless Components
Stars: ✭ 2,977 (+4551.56%)
Mutual labels:  lambda, aws-lambda, api-gateway
Mangum
AWS Lambda & API Gateway support for ASGI
Stars: ✭ 475 (+642.19%)
Mutual labels:  lambda, aws-lambda, api-gateway
Corgi
AWS Lambda / API Gateway native, fast and simple web framework
Stars: ✭ 44 (-31.25%)
Mutual labels:  lambda, aws-lambda, api-gateway
Hello Lambda
🔥 An example of a Python (AWS) Lambda exposed with API Gateway, configured with Terraform.
Stars: ✭ 114 (+78.13%)
Mutual labels:  lambda, aws-lambda, api-gateway
Zappa
Serverless Python
Stars: ✭ 11,859 (+18429.69%)
Mutual labels:  lambda, aws-lambda, api-gateway
Serverlessish
Run the same Docker images in AWS Lambda and AWS ECS
Stars: ✭ 177 (+176.56%)
Mutual labels:  lambda, aws-lambda
Es2017 Lambda Boilerplate
AWS Lambda boilerplate for Node.js 6.10, adding ES2018/7/6 features, Docker-based unit testing and various CI/CD configurations
Stars: ✭ 169 (+164.06%)
Mutual labels:  lambda, aws-lambda
Micro Aws Lambda
A 7KB and 0 dependencies AWS Lambda library which supports middleware and easy debug.
Stars: ✭ 181 (+182.81%)
Mutual labels:  lambda, aws-lambda
Aws Lambda Fastify
Insipired by aws-serverless-express to work with Fastify with inject functionality.
Stars: ✭ 190 (+196.88%)
Mutual labels:  lambda, api-gateway

Build Status GoDoc Go Report Card

Shim

Shim is a thin layer between API Gateway integration requests via Lambda and the standard library http.Handler interface. It allows you to write plain ol' Go and run it on Lambda with minimal modifications. Bring your own router!

Shim uses Go modules to model its dependencies.

Example

For an extensive example on how shim fits in with other AWS serverless tooling like SAM Local and the Serverless Application Model (SAM) specification head over to the this example in the wiki

Note: API Gateway

Make sure that proxy pass integration in API Gateway is enabled to make sure your application receives every request sent to your API Gateway endpoint.

Code

package main

import (
  "fmt"
  "net/http"

  "github.com/aws/aws-lambda-go/lambda"

  "github.com/iamatypeofwalrus/shim"
)

func main() {
  // Create a router as normal. Any router that satisfies the http.Handler interface
  // is accepted!
  mux := http.NewServeMux()
  mux.HandleFunc("/", func(w http.ResponseWriter, req *http.Request) {
    fmt.Fprint(w, "hello, world")
  })

  s := shim.New(mux)

  // Pass your router to shim and let Lambda handle the rest
  lambda.Start(s.Handle)
}

With Debugging Logger

You can pull logs from various steps in the shim by passing the SetDebugLogger option. It accepts any logger that provides the Println and Printf functions a lá the standard library logger.

func main() {
  ...

  l := log.New(os.Stdout, "", log.LstdFlags)
  shim := shim.New(
    nil, // or your mux
    shim.SetDebugLogger(l)
  )

  ...
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].