2020-11-10 20:56:27 +00:00
|
|
|
//#define CROW_STATIC_DRIECTORY "alternative_directory/"
|
|
|
|
//#define CROW_STATIC_ENDPOINT "/alternative_endpoint/<path>"
|
2021-07-05 09:18:00 +00:00
|
|
|
//#define CROW_DISABLE_STATIC_DIR
|
2020-10-04 16:29:56 +00:00
|
|
|
#include "crow.h"
|
|
|
|
|
|
|
|
int main()
|
|
|
|
{
|
|
|
|
|
2021-11-25 11:45:38 +00:00
|
|
|
//Crow app initialization
|
|
|
|
crow::SimpleApp app;
|
2020-10-04 16:29:56 +00:00
|
|
|
|
|
|
|
//
|
2021-11-25 11:45:38 +00:00
|
|
|
CROW_ROUTE(app, "/")
|
2021-11-27 12:28:50 +00:00
|
|
|
([](const crow::request&, crow::response& res) {
|
2020-10-04 16:29:56 +00:00
|
|
|
//replace cat.jpg with your file path
|
|
|
|
res.set_static_file_info("cat.jpg");
|
2021-11-25 11:45:38 +00:00
|
|
|
res.end(); });
|
2020-10-04 16:29:56 +00:00
|
|
|
|
2021-11-21 16:00:44 +00:00
|
|
|
|
2021-11-25 11:45:38 +00:00
|
|
|
app.port(18080).run();
|
2021-11-21 16:00:44 +00:00
|
|
|
|
|
|
|
|
2021-11-25 11:45:38 +00:00
|
|
|
return 0;
|
2020-10-04 16:29:56 +00:00
|
|
|
}
|
2020-11-10 20:56:27 +00:00
|
|
|
|
|
|
|
/// You can also use the `/static` directory and endpoint (the directory needs to have the same path as your executable).
|
|
|
|
/// Any file inside the static directory will have the same path it would in your filesystem.
|
|
|
|
|
|
|
|
/// TO change the static directory or endpoint, use the macros above (replace `alternative_directory` and/or `alternative_endpoint` with your own)
|