Is it possible to have a variable number of path parameters on an API gateway URL?
i.e. APIGW runs theoretical lambda function that sums numbers in a URL:
/dev/myservice/sum/1/2 => sum(1,2) => 3
/dev/myservice/sum/1/2/3/3/3 => sum(1,2,3,3,3) => 12
If this is possible, then how do I do it?
You can use greedy path variables like /myservice/sum/{proxy+} and the lambda proxy integration (used by the serveless framework) to solve this use case.
You can use the standard API Gateway proxy features, no need to use the serverless framework (although the framework is great for other reasons).
In the console it's pretty easy, this guide should take you through the setup. http://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-create-api-as-simple-proxy-for-lambda.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With