2021-02-20 21:28:32 +00:00
|
|
|
#define CROW_MAIN_
|
2021-01-02 19:12:04 +00:00
|
|
|
#include "crow.h"
|
|
|
|
#include "crow/compression.h"
|
|
|
|
|
|
|
|
int main()
|
|
|
|
{
|
|
|
|
crow::SimpleApp app;
|
|
|
|
//crow::App<crow::CompressionGzip> app;
|
|
|
|
|
|
|
|
CROW_ROUTE(app, "/hello")
|
|
|
|
([&](const crow::request&, crow::response& res){
|
|
|
|
res.compressed = false;
|
|
|
|
|
|
|
|
res.body = "Hello World! This is uncompressed!";
|
|
|
|
res.end();
|
|
|
|
});
|
|
|
|
|
|
|
|
CROW_ROUTE(app, "/hello_compressed")
|
|
|
|
([](){
|
|
|
|
return "Hello World! This is compressed by default!";
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
app.port(18080)
|
|
|
|
.use_compression(crow::compression::algorithm::DEFLATE)
|
|
|
|
//.use_compression(crow::compression::algorithm::GZIP)
|
|
|
|
.loglevel(crow::LogLevel::Debug)
|
|
|
|
.multithreaded()
|
|
|
|
.run();
|
|
|
|
}
|