https://github.com/apex/apex-go
Golang runtime for Apex/Lambda.
https://github.com/apex/apex-go
apex golang lambda serverless
Last synced: 13 days ago
JSON representation
Golang runtime for Apex/Lambda.
- Host: GitHub
- URL: https://github.com/apex/apex-go
- Owner: apex
- License: mit
- Created: 2016-01-27T00:08:36.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2018-01-18T00:00:47.000Z (over 7 years ago)
- Last Synced: 2025-04-02T11:07:06.855Z (20 days ago)
- Topics: apex, golang, lambda, serverless
- Language: Go
- Size: 68.4 KB
- Stars: 292
- Watchers: 25
- Forks: 31
- Open Issues: 16
-
Metadata Files:
- Readme: Readme.md
- License: LICENSE
Awesome Lists containing this project
README
# Apex Golang
Golang runtime support for Apex/Lambda – providing handlers for Lambda sources, and runtime requirements such as implementing the Node.js shim stdio interface.
__NOTE__: `apex` v1.x supports native Go, so you should use https://github.com/aws/aws-lambda-go instead of this package.
## Features
Currently supports:
- Node.js shim
- Environment variable population
- Arbitrary JSON
- CloudWatch Logs
- Cognito
- Kinesis
- Dynamo
- S3
- SNS
- SES## Example
```go
package mainimport (
"encoding/json"
"strings""github.com/apex/go-apex"
)type message struct {
Value string `json:"value"`
}func main() {
apex.HandleFunc(func(event json.RawMessage, ctx *apex.Context) (interface{}, error) {
var m messageif err := json.Unmarshal(event, &m); err != nil {
return nil, err
}m.Value = strings.ToUpper(m.Value)
return m, nil
})
}
```Run the program:
```
echo '{"event":{"value":"Hello World!"}}' | go run main.go
{"value":{"value":"HELLO WORLD!"}}
```## Notes
Due to the Node.js [shim](http://apex.run/#understanding-the-shim) required to run Go in Lambda, you __must__ use stderr for logging – stdout is reserved for the shim.
## Badges
[](https://semaphoreci.com/tj/go-apex)
[](https://godoc.org/github.com/apex/go-apex)


[](https://apex.sh/ping/)---
> [tjholowaychuk.com](http://tjholowaychuk.com) ·
> GitHub [@tj](https://github.com/tj) ·
> Twitter [@tjholowaychuk](https://twitter.com/tjholowaychuk)