Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Echo support? #198

Open
algoflows opened this issue Apr 29, 2024 · 1 comment
Open

Echo support? #198

algoflows opened this issue Apr 29, 2024 · 1 comment

Comments

@algoflows
Copy link

Does this support Echo framework?

https://echo.labstack.com/

@thomasgtaylor
Copy link

thomasgtaylor commented May 27, 2024

Yep! Sure does.

import (
	"net/http"

	"github.com/labstack/echo/v4"
	"github.com/aws/aws-lambda-go/events"
	"github.com/aws/aws-lambda-go/lambda"
	"github.com/awslabs/aws-lambda-go-api-proxy/echo"
)

var (
	echoLambda *echoadapter.EchoLambdaV2
)

func init() {
	e := echo.New()
	e.GET("test", func(c echo.Context) error {
		return c.String(http.StatusOK, "hello world")
	})
	echoLambda = echoadapter.NewV2(e)
}

func Handler(ctx context.Context, req events.APIGatewayV2HTTPRequest) (events.APIGatewayV2HTTPResponse, error) {
	return echoLambda.ProxyWithContext(ctx, req)
}

func main() {
	lambda.Start(Handler)
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants