Add not found handler

This commit is contained in:
Gabriel Augendre 2023-01-01 03:13:53 +01:00
parent 418499aff8
commit 7904bb6707
2 changed files with 3 additions and 1 deletions

View file

@ -1,7 +1,7 @@
# Buzzer # Buzzer
## Build ## Build
```shell ```shell
platformio run --target uploadfs --environment wemos_d1_mini32 platformio run --target uploadfs
platformio run --target upload platformio run --target upload
``` ```

View file

@ -110,6 +110,8 @@ void setup()
server.on("/play", HTTP_GET, onPlay); server.on("/play", HTTP_GET, onPlay);
server.on("/available-files", HTTP_GET, onAvailableFiles); server.on("/available-files", HTTP_GET, onAvailableFiles);
server.on("/select-file", HTTP_POST, onSelectFile); server.on("/select-file", HTTP_POST, onSelectFile);
server.onNotFound([](AsyncWebServerRequest *request)
{ request->send(404); });
server.serveStatic("/", SPIFFS, "/www/").setDefaultFile("index.html"); server.serveStatic("/", SPIFFS, "/www/").setDefaultFile("index.html");
server.begin(); server.begin();