Sample project using AWS SAM to setup an API Gateway proxied Lambda Function.
I didn't see any good examples of API Gateway proxied Lambda Functions using SAM...
First you need SAM Local:
npm install -g aws-sam-local
To run via SAM local:
sam local start-api
Make some requests:
curl http://localhost:3000
=> Hello World!
curl http://localhost:3000/?name=Rowen
=> Hello Rowen
curl -d '{"name":"Raili"}' -H "Content-Type: application/json" -X POST http://localhost:3000
=> Hello Raili
Run the deploy script...
./deploy.sh YOUR_S3_BUCKET YOUR_STACK_NAME
This will output the API Gateway endpoint to which you can make requests like above.
Check out deploy.sh to see what it is doing.
Please let me know if you have feedback or improvements.