formatted example.cpp

This commit is contained in:
The-EDev 2021-12-14 06:55:59 +03:00
parent f6fd7dc85d
commit 5c806252f0
No known key found for this signature in database
GPG Key ID: 51C45DC0C413DCD9

View File

@ -124,13 +124,15 @@ int main()
}); });
//same as the example above but uses mustache instead of stringstream //same as the example above but uses mustache instead of stringstream
CROW_ROUTE(app,"/add_mustache/<int>/<int>") CROW_ROUTE(app, "/add_mustache/<int>/<int>")
([](int a, int b){ ([](int a, int b) {
auto t = crow::mustache::compile("Value is {{func}}"); auto t = crow::mustache::compile("Value is {{func}}");
crow::mustache::context ctx; crow::mustache::context ctx;
ctx["func"] = [&](std::string){return std::to_string(a+b);}; ctx["func"] = [&](std::string) {
auto result = t.render(ctx); return std::to_string(a + b);
return result; };
auto result = t.render(ctx);
return result;
}); });
// Compile error with message "Handler type is mismatched with URL paramters" // Compile error with message "Handler type is mismatched with URL paramters"