According to the update posted in September 2016, API Gateway supports Catch-all Path Variables. For example a single greedy path /store/{proxy+}
will intercept requests made to /store/list-products
, /store/add-product
, and /store/delete-product
.
I could not find any reference to this feature in docs and forum. Is it supported?
Yes, it is supported.
For example:
...
functions:
api:
handler: YOUR_HANDLER
events:
- http:
path: store/{proxy+}
method: any
...
2 Likes
Also note that if you want to handle /store
you’ll need a second event that handles that path without the {proxy+}
part.
I do this for aws-serverless-express, and point all my http events to the same handler.
Thanks, seems like I am going to be able make use of this.
that was very helpful, thanks! also works with serverless-offline plugin