simple serial monitor in httpserver

This commit is contained in:
2021-06-26 10:49:29 +02:00
parent 4e6445fea8
commit b89604edc3
6 changed files with 75 additions and 15 deletions
-7
View File
@@ -1,12 +1,5 @@
#include "filesys.h"
// listDir("/");
// deleteFile("/hello.txt");
// writeFile("/hello.txt", "Hello ");
// appendFile("/hello.txt", "World!\n\r");
// printFile("/hello.txt");
// listDir("/");
FSInfo fsinfo;
bool mount_fs() {
+2
View File
@@ -2,6 +2,8 @@
#include <LittleFS.h>
// some usefull wrappers for Filesystem
bool mount_fs();
bool format_fs();
+9 -1
View File
@@ -38,6 +38,7 @@ public:
File f = open("/compress.html.gz");
if (!f) {
Serial.println("Failed to open file for reading");
send(404, "text/plain", "Failed to open file for reading");
}
else
{
@@ -50,7 +51,7 @@ public:
File f = open("/comp.html.gz");
if (!f) {
Serial.println("Failed to open file for reading");
send(404, "text/plain", "Failed to open file for reading");
}
else
{
@@ -58,7 +59,14 @@ public:
const String cont = "text/html";
streamFile(f, cont);
}
});
on("/terminal", [this]() {
String log_msg = "terminal: millis: ";
log_msg += millis();
send(200, "text/plain", log_msg);
});
onNotFound([this]() {
String message = "File Not Found\n\n";
message += "URI: ";