Skip to content

Instantly share code, notes, and snippets.

@mweagle
Created January 22, 2018 02:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mweagle/a90252140cb21d172f96976092cab168 to your computer and use it in GitHub Desktop.
Save mweagle/a90252140cb21d172f96976092cab168 to your computer and use it in GitHub Desktop.
type helloWorldResponse struct {
Message string
Request spartaAPIG.APIGatewayRequest
}
////////////////////////////////////////////////////////////////////////////////
// Hello world event handler
func helloWorld(ctx context.Context,
gatewayEvent spartaAPIG.APIGatewayRequest) (helloWorldResponse, error) {
logger, loggerOk := ctx.Value(sparta.ContextKeyLogger).(*logrus.Logger)
if loggerOk {
logger.Info("Hello world structured log message")
}
// Return a message, together with the incoming input...
return helloWorldResponse{
Message: fmt.Sprintf("Hello world 🌏"),
Request: gatewayEvent,
}, nil
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment