I have a issue deploying a Go application that uses fuego as a router and handling middleware. Is it possible to use fuego when deploying a go application to Lambda?
using lambda.start(handler)
I have tested using fuegos handler but don’t seems to work. Also created a handler to route traffic but doesn’t seem to work.
{
s := fuego.NewServer()
lambda.Start(lambdaHandler(s))
}
func lambdaHandler(s *fuego.Server) func(ctx context.Context, req events.APIGatewayProxyRequest) (events.APIGatewayProxyResponse, error) {
return func(ctx context.Context, req events.APIGatewayProxyRequest) (events.APIGatewayProxyResponse, error) {
httpRequest, err := convertAPIGatewayToHTTPRequest(req)
if err != nil {
return events.APIGatewayProxyResponse{StatusCode: http.StatusInternalServerError, Body: err.Error()}, nil
}
recorder := httptest.NewRecorder()
s.ServeHTTP(recorder, httpRequest)
apiGatewayResponse, err := convertHTTPResponseToAPIGateway(recorder.Result())
if err != nil {
return events.APIGatewayProxyResponse{StatusCode: http.StatusInternalServerError, Body: err.Error()}, nil
}
return apiGatewayResponse, nil
}
}
Anyone that has a fix or another example to use for golang api managed by aws?