You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
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.
The text was updated successfully, but these errors were encountered: