Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New feature: adding parametric url components as parameters to request #426

Open
ClaudeTO80 opened this issue Mar 19, 2024 · 0 comments
Open

Comments

@ClaudeTO80
Copy link

Hi all.
I am trying, if possible, to create a generic approch for definition of routing rules.

Up to now parametric elements of URL can be defined and handled in such way, which works good
_CROW_ROUTE(app, "/v2/hello/<int>").methods("GET"method)([&](const crow::request& req,int count) {...});

My request is if could be possible setting up another way for handling parametric elements of URL. Such approach would not require input arguments of called lambda matching to URL paramaters, but storing such parameters as key/value strings in request. A possible example could be

CROW_ROUTE(app, "/v2/hello/<int>").url_params_names("firstParamName").methods("GET"method)([&](const crow::request& req)
{
...
std::string count = req.getUrlParam("firstParamName"); //
getUrlParam
or any other method name
...
});_

Such approach could be coupled with route_dynamic method which requires a parametric string known at runtime and not at compile time. This way routing information could be fully taken from a configuration file (example XML) and runtime function loaded at runtime from a shared library. Of course developer is in charge of handling correctly each detail of routing rules and function calls. As a result, it could be possibile splitting running application from routes definition. Routes could be dynamically added and removed only via configuration (e.g. XML) and keeping updated shared library of functions called.

My planes are using POCO C++ library for handling shared libraries and loading their symbols.

I hope my request is clear.
Best things.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant