Use wildcard in path for http endpoints

For my functions events…I have many such endpoints defined…I was hoping if I could consolidate it into one handler in my node.js code…

handler: pages/router-build.router
events:
  - http:
      path: pages/{id}
      method: get
      cors: true
  - http:
      path: pages/{id}
      method: post
      cors: true             
  - http:
      path: pages/name/{id}
      method: any
      cors: true

Is it possible to merge all above as single endpoint as below. If so, how would I handle in my Node.js lambda code…Can someone please guide…I am hittng the 200 max resources cloudformation limit & need to consolidate apis to handle this issue

       Is this possibe
handler: pages/router-build.router
events:           
	- http:
      path: pages/*
      method: any
      cors: true

Hi @sshroff ,
You can use catch-all / greedy path variables: pages/{proxy+} - note that you need an additional mapping to /pages, as well, if you want to catch requests to /pages, too.
See: https://aws.amazon.com/blogs/aws/api-gateway-update-new-features-simplify-api-development/

In general you can fetch the resolved path from the request object: requestObject.path.
Note: if you start using a custom domain, the base path - if any - will be prepended, then.

@sshroff You need something like

functions:
  hello:
    handler: handler.router
    events:
      - http:
          path: resource
          method: any
          cors: true
      - http:
          path: resource/{id}
          method: any
          cors: true

I wrote a blog post about it with code you can copy here