From 6fa2b0985139b0818b4bcda45fcf1e67251f0007 Mon Sep 17 00:00:00 2001 From: Leonie <135235065+DenialOfIntelligence@users.noreply.github.com> Date: Tue, 31 Oct 2023 12:30:59 +0100 Subject: [PATCH] Add 404 to simple_web/explanation.md --- simple_web/explanation.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/simple_web/explanation.md b/simple_web/explanation.md index fc34052..0ab150f 100644 --- a/simple_web/explanation.md +++ b/simple_web/explanation.md @@ -5,6 +5,13 @@ AsyncWebServer server(80); ``` Start the Web Server on port 80 +``` +void notFound(AsyncWebServerRequest *request) { + request->send(404, "text/plain", "Not found"); +} +``` +This will handle requests on wrong uri's with this code `server.onNotFound(notFound);` + ``` WiFi.begin(ssid, password); if (WiFi.waitForConnectResult() != WL_CONNECTED) {