NodeMCUv3 ESP8266 WebServer from SD-Card

Dear community,

i havnt got a Solution from Web, but i coded one by myself.
My Question is:
Is there another method I can use to do the same the code now does?
I want to read the index.html file from ym sdacrd using my esp8266 and use this file as my index-file for webserver.
The Code i currently using is:

 Serial.print("Initializing SD card...");

  if (!SD.begin(15)) {
    Serial.println("initialization failed!");
    return;
  }
  Serial.println("initialization done.");


  myFile = SD.open("index.html", FILE_READ);
server.on("/", HTTP_GET, [](AsyncWebServerRequest *request){
        request->send(200, "text/html", myFile.readString());
    });

Which works great. But my question is: is this more work for the microcontroller or is this the best solution to read the idnex.html from sd-card?
If not, please let me know a better solution!
If this is the only SOlution, Ill make a tutorial how to use a SD-Card for WebServer content, cuz i coded the solution bymyself.

Greetz BlackLeakz,
and sorry for my bad english

see the FSBrowser example of the ESP8266WebServer library

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.