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 route regex

flyingsky opened this issue · comments

commented

It seems now only supports fixed route, like "hello", how to support "hello*"?

The real problem is I want to support rest service like '/project/:id?' and '/media/:id?', or more types in future. I don't want to add same code in the router. Also in AWS API Gateway, it's not necessary to create multiple resources, I just have two, "/{model}" and "/{model}/{id}".

If API Gateway supports regex, I hope just one resource like "/{model}/{id}?".

commented

I find a workaround. Actually I just api.get('/{model}', function () {}), it still create path variable resource. And I can getmodel` value from request.pathParams.model.