How to transform HTTP requests to Lambda events exactly as AWS API Gateway does as an HTTP proxy?

0

I'm developing a Lambda service behind an API Gateway as an HTTP proxy[1].

As the docs say, API Gateway basically transforms the HTTP request into a JSON Lambda Event.

In order to support the development process, I wonder if there is a library I could use to do that: transform an HTTP request into a JSON Lambda Event.

That way I could develop locally, wrapping my lambda implementation in a dummy web server whose work would be to transform and pass the event to my code.

[1] https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-develop-integrations-lambda.html

jgomo3
已提問 1 年前檢視次數 822 次
1 個回答
1

I recommends that you use SAM CLI for local testing. Using SAM CLI you can invoke your functions locally using the sam local start-api command, that will start also a local API gateway and will invoke your code when you CURL the local end-point. You could also use sam local generate-event to create the event object that is used by API Gateway and use it when invoking the function directly using sam local invoke.

profile pictureAWS
專家
Uri
已回答 1 年前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南