Пример #1
0
func main() {
	apex.HandleFunc(func(event json.RawMessage, ctx *apex.Context) (interface{}, error) {
		log.Println(string(event))
		var params proxy.Params
		if err := json.Unmarshal(event, &params); err != nil {
			return nil, err
		}
		if err := proxy.Process(event, params.Body); err != nil {
			return nil, err
		}
		if err := s3.Upload(event, params.Account); err != nil {
			return nil, err
		}
		return nil, errors.New("Upload to S3 - OK. Proxy Request - OK")
	})

}
Пример #2
0
func Example() {
	apex.HandleFunc(func(event json.RawMessage, ctx *apex.Context) (interface{}, error) {
		return &Message{"world"}, nil
	})
}
Пример #3
0
func main() {
	apex.HandleFunc(func(event json.RawMessage, ctx *apex.Context) (interface{}, error) {
		return &Message{"bar"}, nil
	})
}