Update to version 3.7.4

This commit is contained in:
2025-03-28 10:07:10 +01:00
parent b12c714d5e
commit 7757b92aeb
12 changed files with 142 additions and 30 deletions

View File

@ -105,6 +105,22 @@ void setup() {
f.close();
}
LittleFS.mkdir("/files");
{
File f = LittleFS.open("/files/a.txt", "w");
assert(f);
f.print("Hello from a.txt");
f.close();
}
{
File f = LittleFS.open("/files/b.txt", "w");
assert(f);
f.print("Hello from b.txt");
f.close();
}
// curl -v http://192.168.4.1/
server.on("/", HTTP_GET, [](AsyncWebServerRequest *request) {
request->redirect("/index.html");
@ -113,6 +129,12 @@ void setup() {
// curl -v http://192.168.4.1/index.html
server.serveStatic("/index.html", LittleFS, "/index.html");
// Example to serve a directory content
// curl -v http://192.168.4.1/base/ => serves a.txt
// curl -v http://192.168.4.1/base/a.txt => serves a.txt
// curl -v http://192.168.4.1/base/b.txt => serves b.txt
server.serveStatic("/base", LittleFS, "/files").setDefaultFile("a.txt");
server.begin();
}