WIP: service and broken partitions
This commit is contained in:
24
include/spore/services/StaticFileService.h
Normal file
24
include/spore/services/StaticFileService.h
Normal file
@@ -0,0 +1,24 @@
|
||||
#pragma once
|
||||
#include "spore/Service.h"
|
||||
#include "spore/core/ApiServer.h"
|
||||
#include "spore/core/NodeContext.h"
|
||||
#include <FS.h>
|
||||
#include <LittleFS.h>
|
||||
|
||||
class StaticFileService : public Service {
|
||||
public:
|
||||
StaticFileService(NodeContext& ctx, ApiServer& apiServer);
|
||||
void registerEndpoints(ApiServer& api) override;
|
||||
const char* getName() const override { return name.c_str(); }
|
||||
|
||||
private:
|
||||
static const String name;
|
||||
NodeContext& ctx;
|
||||
ApiServer& apiServer;
|
||||
|
||||
void handleRootRequest(AsyncWebServerRequest* request);
|
||||
void handleStaticFileRequest(AsyncWebServerRequest* request);
|
||||
void handleNotFound(AsyncWebServerRequest* request);
|
||||
String getContentType(const String& filename);
|
||||
bool fileExists(const String& path);
|
||||
};
|
||||
Reference in New Issue
Block a user