claudiajs / claudia-api-builder

Use AWS API Gateway as if it were a lightweight JavaScript web server

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support for multiple path params

kshinn opened this issue · comments

I have been experimenting with claudia / claudia API builder and it has been working rather well. One of our use cases requires a path that looks like: /user/{foo}/subresource/{bar}

When defining a path in the api builder with this format and running claudia update I am getting an error back:

[BadRequestException: Resource's path part only allow a-zA-Z0-9._- and curly braces at the beginning and the end.

When I only define one dynamic path parameter, claudia will post to AWS just fine.

Update: This may be an invalid request. I noticed our paths were actually defined as: /user/{foo}/subresources/{bar}.json. This is what will not work. The above mentioned path does work. I do not know if {bar}.json is a use case cladia will want to support or if it is a limitation of ApiGateway.

Feel free to close as invalid.

this is a limitation of api gateway, not claudia. the way I work around that is /user/{foo}/subresources/{barExt} and then remove the extension from barExt in the code

commented

You can have workaround as my issue: #12

you define route "/user/{foo}" and "/user/{foo}/subresource/{bar}". To get path variable {foo} and {bar} you can use request.pathParams.foo and request.pathParams.bar.

@flyingsky that's not a workaround, that is how API Gateway works by design.