I was wondering how to implement a query for either a collection or a subresource, using the same handler. For example, say we have /products and /products/{product_id} -- it is currently impossible to manage both in the same handler conveniently.
I was wondering if it could be possible to use web::Path<Option<String>> for such cases, and have the handler check if a product id was specified in the URL. If that sounds reasonable I can try and craft a PR for it.
I was wondering how to implement a query for either a collection or a subresource, using the same handler. For example, say we have
/productsand/products/{product_id}-- it is currently impossible to manage both in the same handler conveniently.I was wondering if it could be possible to use
web::Path<Option<String>>for such cases, and have the handler check if a product id was specified in the URL. If that sounds reasonable I can try and craft a PR for it.