Skip to content
This repository was archived by the owner on May 21, 2025. It is now read-only.

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 subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants