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")
|
2021-11-25 11:45:38 +00:00
|
|
|
([&](const crow::request&, crow::response& res)
|
|
|
|
{
|
2021-01-02 19:12:04 +00:00
|
|
|
res.compressed = false;
|
|
|
|
|
|
|
|
res.body = "Hello World! This is uncompressed!";
|
2021-11-25 11:45:38 +00:00
|
|
|
res.end(); });
|
2021-01-02 19:12:04 +00:00
|
|
|
|
|
|
|
CROW_ROUTE(app, "/hello_compressed")
|
2021-11-25 11:45:38 +00:00
|
|
|
([]()
|
|
|
|
{ return "Hello World! This is compressed by default!"; });
|
2021-01-02 19:12:04 +00:00
|
|
|
|
|
|
|
|
|
|
|
app.port(18080)
|
2021-11-25 11:45:38 +00:00
|
|
|
.use_compression(crow::compression::algorithm::DEFLATE)
|
2021-01-02 19:12:04 +00:00
|
|
|
//.use_compression(crow::compression::algorithm::GZIP)
|
2021-11-25 11:45:38 +00:00
|
|
|
.loglevel(crow::LogLevel::Debug)
|
|
|
|
.multithreaded()
|
|
|
|
.run();
|
2021-01-02 19:12:04 +00:00
|
|
|
}
|