18 lines
445 B
C++
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");
|
|
} |