MBD is a Go framework for AWS Lambda, currently focused on the API Gateway integration. It wraps the official AWS Lambda framework and provides a simplified handler signature, case-insensitive access to headers, query string parameters, and other types of request metadata. It interoperates well with the ibrt/errors package to return configurable, rich error responses, optionally complete with debug information.
package main
import (
"github.com/ibrt/mbd"
)
type echoRequest struct {
Value string `json:"value"`
}
type echoResponse struct {
Value string `json:"value"`
}
func main() {
mbd.NewFunction(echoRequest{}, echoHandler).Start()
}
func(ctx context.Context, req interface{}) (interface{}, error) {
echoRequest := req.(*echoRequest)
return &echoResponse{Value: echoRequest.Value}, nil
}