diff options
Diffstat (limited to 'example.cpp')
-rw-r--r-- | example.cpp | 20 |
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) |