Handle WebServer

This commit is contained in:
Serge NOEL
2026-02-23 18:46:34 +01:00
parent 1376be6797
commit 1d41d336ea
4 changed files with 29 additions and 66 deletions

18
src/WebServer.cpp Normal file
View File

@@ -0,0 +1,18 @@
#include <Arduino.h>
#include <LittleFS.h>
#include "main.h"
#include "WebServer.h"
void handlePage(char *page) {
if (LittleFS.exists(page)) {
File file = LittleFS.open(page, "r");
if (file) {
String html = file.readString();
server.send(200, "text/html", html);
file.close();
return;
}
}
server.send(404, "text/plain", "Page not found");
}