From 03f6d6c818790c2e8298bebf110a44fc778b810d Mon Sep 17 00:00:00 2001 From: Farook Date: Sun, 4 Oct 2020 19:29:56 +0300 Subject: [PATCH] added static file example --- examples/example_static_file.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 examples/example_static_file.cpp diff --git a/examples/example_static_file.cpp b/examples/example_static_file.cpp new file mode 100644 index 000000000..fbeadcce0 --- /dev/null +++ b/examples/example_static_file.cpp @@ -0,0 +1,22 @@ +#include "crow.h" + +int main() +{ + + //Crow app initialization + crow::SimpleApp app; + + // +CROW_ROUTE(app, "/") +([](const crow::request&, crow::response& res) { + //replace cat.jpg with your file path + res.set_static_file_info("cat.jpg"); + res.end(); +}); + + + app.port(18080).run(); + + + return 0; +}