Crow/examples/example_compression.cpp
Luca Schlecker e5c7daccce remove every occurance of #define CROW_MAIN.
Signed-off-by: Luca Schlecker <luca.schlecker@hotmail.com>
2021-11-21 17:25:16 +01:00

30 lines
686 B
C++

#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();
}