ESPAsyncWebserver handler example with int query argument
This example is based on our basic example and shows how to use an int
query parameter, e.g. http://192.168.1.112/api/test?param=2
server.on("/api/test", HTTP_GET, [](AsyncWebServerRequest *request) {
int param = request->getParam("param")->value().toInt();
// 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);
});