mirror of
https://github.com/CrowCpp/Crow.git
synced 2024-06-07 21:10:44 +00:00
added static file example
This commit is contained in:
parent
24c04c65cf
commit
03f6d6c818
22
examples/example_static_file.cpp
Normal file
22
examples/example_static_file.cpp
Normal file
@ -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;
|
||||
}
|
Loading…
Reference in New Issue
Block a user