ESPAsyncWebserver handler example with String query argument
This example is based on our basic example and shows how to use an String
query parameter, e.g. http://192.168.1.112/api/test?param=abc123
server.on("/api/test", HTTP_GET, [](AsyncWebServerRequest *request) {
String param = request->getParam("param")->value();
// TODO: Do something with param!
// Respond with JSON {"status": "ok"}
AsyncResponseStream *response = request->beginResponseStream("application/json");
DynamicJsonDocument json(1024);
json["status"] = "ok";
json["param"] = param;
serializeJson(json, *response);
request->send(response);
});