ipkn / crow

Crow is very fast and easy to use C++ micro web framework (inspired by Python Flask)
BSD 3-Clause "New" or "Revised" License
7.43k stars 889 forks source link

Special #392

Closed asciphx closed 3 years ago

asciphx commented 3 years ago

introduce

This is a modified version, in order to support the latest version of boost,and cross platform as well as modular development.

Requirements

Handling JSON Requests

CROW_ROUTE(app, "/add_json").methods("POST"_method)
([](const crow::Req& req){
    auto x = crow::json::load(req.body);
    if (!x)
        return crow::Res(400);
    std::ostringstream os;
    os << x.dump();
    return crow::Res{os.str()};
});