2017 September Golang Sydney meetup https://www.meetup.com/golang-syd/events/243263974/
Yun Zhi Lin wrote serverless-golang to bring about the perfect combination of strongly typed idiomatic Golang with the simplicity of Serverless Framework.
Serverless Golang currently forms the backbone of amaysim’s Serverless Realtime Event Driven Architecture, Anti-Corruption Layer and Single Customer View across 4 business verticals.
The library comes with easy to follow real world examples, and is entirely built and deployed immutably via Docker.
11. Kinesis Event Source
Go code serverless.yml
func DataLogger(
evt *kinesisstreamsevt.Event)(
interface{}, error) {
rs := evt.Records
for r := range rs {
log.Println(r)
}
return evt.String(), nil
}
functions:
logger:
handler:
handler.DataLogger
events:
- stream:
${env:AWS_KINESIS_ARN}
12. Go Net with API Gateway
Go code serverless.yml
functions:
crud:
handler: handler.Handler
events:
- http:
path: todos
method: post
cors: true
- http:
path: todos
method: get
cors: true
- http:
path: todos/{id}
method: get
cors: true
func setUpMux() *mux.Router {
r := mux.NewRouter()
r.HandleFunc("/todos", create)
.Methods(http.MethodPost)
r.HandleFunc("/todos", list)
.Methods(http.MethodGet)
r.HandleFunc("/todos/{id}", read)
.Methods(http.MethodGet)
…
return r
}
14. Credits and Road Map
This library would not be possible without the help of:
• @cristm from HereMaps
• Serverless.com and Eawsy.com
• @flemay from amaysim for the awesome logo
Coming soon:
• dynamodb example with localstack
• Event Gateway and FDK
• Azure integration