mirror of
https://github.com/CrowCpp/Crow.git
synced 2024-06-07 21:10:44 +00:00
formatted example.cpp
This commit is contained in:
parent
f6fd7dc85d
commit
5c806252f0
@ -124,11 +124,13 @@ 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) {
|
||||||
|
return std::to_string(a + b);
|
||||||
|
};
|
||||||
auto result = t.render(ctx);
|
auto result = t.render(ctx);
|
||||||
return result;
|
return result;
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user