aboutsummaryrefslogtreecommitdiffstats
path: root/example.cpp
diff options
context:
space:
mode:
authoripknHama <ipknhama@gmail.com>2014-04-13 11:24:06 +0900
committeripknHama <ipknhama@gmail.com>2014-04-13 11:24:06 +0900
commit7ec586556e348725bff3919f4787a75d71c520fa (patch)
treeb9ca0d11bbe6637ab4b451e7d14702a4c167872f /example.cpp
parent152a5c8c2cf2fe59f3b61047db41ad3c9c6c9bd2 (diff)
downloadcrow-7ec586556e348725bff3919f4787a75d71c520fa.tar.gz
crow-7ec586556e348725bff3919f4787a75d71c520fa.zip
compiler error on invalid handler type; still no routing for dynamic url
Diffstat (limited to 'example.cpp')
-rw-r--r--example.cpp20
1 files changed, 15 insertions, 5 deletions
diff --git a/example.cpp b/example.cpp
index c518dc4..9ecf0af 100644
--- a/example.cpp
+++ b/example.cpp
@@ -1,6 +1,6 @@
#include "flask.h"
-#include <iostream>
+#include <sstream>
int main()
{
@@ -13,13 +13,23 @@ int main()
});
app.route("/about")
- ([]{
+ ([](){
return "About Flask example.";
});
- //app.route("/hello/<int>");
- //([]{
- //return "About Flask example.";
+ FLASK_ROUTE(app,"/hello/<int>")
+ ([](int count){
+ if (count > 100)
+ return flask::response(400);
+ std::ostringstream os;
+ os << count << " bottles of beer!";
+ return flask::response(os.str());
+ });
+
+ // Compile error with message "Handler type is mismatched with URL paramters"
+ //FLASK_ROUTE(app,"/another/<int>")
+ //([](int a, int b){
+ //return flask::response(500);
//});
app.port(8080)