awslabs / aws-lambda-go-api-proxy

lambda-go-api-proxy makes it easy to port APIs written with Go frameworks such as Gin (https://gin-gonic.github.io/gin/ ) to AWS Lambda and Amazon API Gateway.
Apache License 2.0
1.05k stars 197 forks source link

Does it support local test? #23

Closed ShawnOY closed 5 years ago

ShawnOY commented 5 years ago

Hello,

I run the sample code but it is not open any port, it's available to support local testing?

sapessi commented 5 years ago

You could start the application in local by starting the framework with the normal code in your main method. Perhaps you can look for environment variables to decide whether you are running in local dev or on Lambda. My recommendation would be to use the SAM CLI to emulate Lambda and API Gateway in local - this allows you to better emulate Lambda's behavior.

ShawnOY commented 5 years ago

Thank you @sapessi

pedrohba1 commented 1 year ago

Just to specify, you can start local development using:

sam local start-api -t ./apps/api/template.yaml

And you need to specify your tempalte.yaml if it's not in the root directory.