-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d47a216
commit f3b9730
Showing
5 changed files
with
84 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
#pragma once | ||
|
||
#include "PsychicEndpoint.h" | ||
#include "PsychicEventSource.h" | ||
#include "PsychicFileResponse.h" | ||
#include "PsychicHandler.h" | ||
#include "PsychicHttpServer.h" | ||
#include "PsychicJson.h" | ||
#include "PsychicRequest.h" | ||
#include "PsychicResponse.h" | ||
#include "PsychicStaticFileHandler.h" | ||
#include "PsychicStreamResponse.h" | ||
#include "PsychicUploadHandler.h" | ||
#include "PsychicVersion.h" | ||
#include "PsychicWebSocket.h" | ||
#include <esp_err.h> | ||
#include <http_status.h> | ||
|
||
using AsyncCallbackWebHandler = PsychicEndpoint; | ||
using AsyncWebServerRequest = PsychicRequest; | ||
using AsyncWebServerResponse = PsychicResponse; | ||
using AsyncJsonResponse = PsychicJsonResponse; | ||
using ArRequestHandlerFunction = PsychicHttpRequestCallback; | ||
using WebRequestMethodComposite = int; | ||
|
||
#define PSYCHIC_OK ESP_OK | ||
#define PSYCHIC_REQ request, | ||
|
||
class AsyncWebServer | ||
{ | ||
private: | ||
PsychicHttpServer* _server; | ||
|
||
public: | ||
AsyncWebServer(uint16_t port = 80) : _server(new PsychicHttpServer(port)) {}; | ||
~AsyncWebServer() { delete _server; }; | ||
void begin() { _server->begin(); }; | ||
void end() { _server->end(); }; | ||
AsyncCallbackWebHandler& on(const char* uri, WebRequestMethodComposite method, ArRequestHandlerFunction onRequest) { return *_server->on(uri, method, onRequest); }; | ||
void onNotFound(ArRequestHandlerFunction fn) { _server->onNotFound(fn); }; | ||
bool removeHandler(AsyncWebHandler* handler) { return _server->removeHandler(handler); return true; }; | ||
|
||
// AsyncCallbackWebHandler& on(const char* uri, ArRequestHandlerFunction onRequest); | ||
// AsyncCallbackWebHandler& on(const char* uri, WebRequestMethodComposite method, ArRequestHandlerFunction onRequest, ArUploadHandlerFunction onUpload); | ||
// AsyncCallbackWebHandler& on(const char* uri, WebRequestMethodComposite method, ArRequestHandlerFunction onRequest, ArUploadHandlerFunction onUpload, ArBodyHandlerFunction onBody); | ||
// AsyncWebRewrite& addRewrite(AsyncWebRewrite* rewrite); | ||
// AsyncWebRewrite& rewrite(const char* from, const char* to); | ||
// bool removeRewrite(AsyncWebRewrite* rewrite); | ||
// bool removeRewrite(const char* from, const char* to); | ||
// AsyncWebHandler& addHandler(AsyncWebHandler* handler); | ||
|
||
// AsyncStaticWebHandler& serveStatic(const char* uri, fs::FS& fs, const char* path, const char* cache_control = NULL); | ||
|
||
// void onFileUpload(ArUploadHandlerFunction fn); | ||
// void onRequestBody(ArBodyHandlerFunction fn); | ||
// void reset(); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters