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
preguntada hace un año822 visualizaciones
1 Respuesta
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
EXPERTO
Uri
respondido hace un año

No has iniciado sesión. Iniciar sesión para publicar una respuesta.

Una buena respuesta responde claramente a la pregunta, proporciona comentarios constructivos y fomenta el crecimiento profesional en la persona que hace la pregunta.

Pautas para responder preguntas