aboutsummaryrefslogtreecommitdiffstats
path: root/example.cpp
diff options
context:
space:
mode:
authoripknHama <ipknhama@gmail.com>2014-08-05 22:38:51 +0900
committeripknHama <ipknhama@gmail.com>2014-08-06 04:07:46 +0900
commit88cc6079cb2ba9790a2d8bb9a5955006bfcc7a16 (patch)
tree10d89cf3d7f4754acc5f61674f16889ca73f01cb /example.cpp
parent9e331deaeecb619221cc0c59c69f14c77bb7c8a4 (diff)
downloadcrow-88cc6079cb2ba9790a2d8bb9a5955006bfcc7a16.tar.gz
crow-88cc6079cb2ba9790a2d8bb9a5955006bfcc7a16.zip
add supporing handlers with res parameter
void handler(const crow::request&, crow::response& res) { res.send(data) res.end() } https://news.ycombinator.com/item?id=8004017
Diffstat (limited to 'example.cpp')
-rw-r--r--example.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/example.cpp b/example.cpp
index 5491ba2..57f8e09 100644
--- a/example.cpp
+++ b/example.cpp
@@ -42,6 +42,14 @@ int main()
return crow::response(os.str());
});
+ CROW_ROUTE(app,"/add/<int>/<int>")
+ ([](const crow::request& req, crow::response& res, int a, int b){
+ std::ostringstream os;
+ os << a+b;
+ res.send(os.str());
+ res.end();
+ });
+
// Compile error with message "Handler type is mismatched with URL paramters"
//CROW_ROUTE(app,"/another/<int>")
//([](int a, int b){