Is Catch-all Path Variables of API Gateway supported?

aws

#1

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?


#2

Yes, it is supported.
For example:

...
functions:
  api:
    handler: YOUR_HANDLER
    events:
      - http:
          path: store/{proxy+}
          method: any
...

#3

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.


#4

Thanks, seems like I am going to be able make use of this.


#5

that was very helpful, thanks! also works with serverless-offline plugin