Files
ESP8266-Station/src/WebServer.cpp
2026-02-28 15:45:09 +00:00

18 lines
445 B
C++

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