-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
34 lines (28 loc) · 779 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package main
import (
"context"
"log"
"github.com/aws/aws-lambda-go/events"
"github.com/aws/aws-lambda-go/lambda"
echoadapter "github.com/awslabs/aws-lambda-go-api-proxy/echo"
"github.com/labstack/echo/v4"
"github.com/labstack/echo/v4/middleware"
"github.com/shiba6v/pprofpage/app/registry"
)
var echoLambda *echoadapter.EchoLambda
func init() {
e := echo.New()
e.Use(middleware.Recover())
s3cli, err := registry.RegisterS3()
if err != nil {
log.Fatalf("cannot initialize s3cli %v", err)
}
registry.RegisterServer(e, s3cli)
echoLambda = echoadapter.New(e)
}
func main() {
lambda.Start(Handler)
}
func Handler(ctx context.Context, req events.APIGatewayProxyRequest) (events.APIGatewayProxyResponse, error) {
return echoLambda.ProxyWithContext(ctx, req)
}