Query strings

Anything after the ? in a URL is parsed automatically. Access it via req.url_params.

Basic usage

CROW_ROUTE(app, "/search")([](const crow::request &req) {
    const char *q = req.url_params.get("q");
    if (!q) return crow::response(400, "missing q");
    return crow::response("you searched for: " + std::string(q));
});

get() returns a const char* or nullptr when the key is absent — always check before dereferencing.

Multiple values

Lists are written as ?tag=a&tag=b:

auto tags = req.url_params.get_list("tag");
for (const auto &t : tags) CROW_LOG_INFO << "tag: " << t;

For application/x-www-form-urlencoded bodies (typical for HTML forms), call req.get_body_params() — the API is identical.