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; +}