From 7904bb6707bac4f0de4d422080cf81caf9811db4 Mon Sep 17 00:00:00 2001 From: Gabriel Augendre Date: Sun, 1 Jan 2023 03:13:53 +0100 Subject: [PATCH] Add not found handler --- README.md | 2 +- src/main.cpp | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 792b4d3..99f9e59 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # Buzzer ## Build ```shell -platformio run --target uploadfs --environment wemos_d1_mini32 +platformio run --target uploadfs platformio run --target upload ``` diff --git a/src/main.cpp b/src/main.cpp index 32ba5bf..97be26d 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -110,6 +110,8 @@ void setup() server.on("/play", HTTP_GET, onPlay); server.on("/available-files", HTTP_GET, onAvailableFiles); server.on("/select-file", HTTP_POST, onSelectFile); + server.onNotFound([](AsyncWebServerRequest *request) + { request->send(404); }); server.serveStatic("/", SPIFFS, "/www/").setDefaultFile("index.html"); server.begin();