/* * * Webserver.ino * * This script handle web serving and RESTFUL API features */ void registerServeEndpoints(){ server.serveStatic("/", LittleFS, "/index.html"); server.onNotFound(handleNotFound); } void handleRoot() { //server.send(200, "text/plain", "Hello world!"); } void handleNotFound() { String message = "404 - Not Found\n\n"; message += "URI: "; message += server.uri(); message += "\nMethod: "; message += (server.method() == HTTP_GET) ? "GET" : "POST"; message += "\nArguments: "; message += server.args(); message += "\n"; for (uint8_t i = 0; i < server.args(); i++) { message += " " + server.argName(i) + ": " + server.arg(i) + "\n"; } server.send(404, "text/plain", message); }