Closed parthasarathyprsd closed 6 years ago
I have not tested these, but <int> <uint> <float> <double> <str> <string> <path>
might be the ones that are recognized.
https://github.com/ipkn/crow/blob/master/include/crow/routing.h#L784
The map of tag to type in utillity.h .
template <int N>
struct single_tag_to_type
{
};
template <>
struct single_tag_to_type<1>
{
using type = int64_t;
};
template <>
struct single_tag_to_type<2>
{
using type = uint64_t;
};
template <>
struct single_tag_to_type<3>
{
using type = double;
};
template <>
struct single_tag_to_type<4>
{
using type = std::string;
};
template <>
struct single_tag_to_type<5>
{
using type = std::string;
};
and type value
enum class ParamType
{
INT,
UINT,
DOUBLE,
STRING,
PATH,
MAX
};
So you can do like this:
CROW_ROUTE(app,"/a/<path>")
([](std::string path){
return path;
});
yes, that worked, thx alot
How to get a non-int resource-id. I cannot add a route
CROW_ROUTE(app, "/uid/<std::string>")
orCROW_ROUTE(app, "/uid/<char*>")
as it ( correctly ) fails to compile. The examples donot have such a case. I have triedBut neither of them ( though correctly ) intercept
GET /uid/uid_123 HTTP/1.1
( with resource being a string"uid_123"
)For below python code, I want to acheive it in c++ crow library
Is there any workaround for the above?