Initial project setup: ESP-IDF + C++ + FreeRTOS + WiFi + web server
This commit is contained in:
24
main/web_server.hpp
Normal file
24
main/web_server.hpp
Normal file
@@ -0,0 +1,24 @@
|
||||
#ifndef WEB_SERVER_HPP
|
||||
#define WEB_SERVER_HPP
|
||||
|
||||
#include <esp_http_server.h>
|
||||
|
||||
class WebServer {
|
||||
public:
|
||||
static WebServer& getInstance();
|
||||
|
||||
void start(int port = 80);
|
||||
void stop();
|
||||
bool isRunning() const;
|
||||
|
||||
private:
|
||||
WebServer() = default;
|
||||
static WebServer instance;
|
||||
httpd_handle_t server = nullptr;
|
||||
|
||||
// HTTP request handlers
|
||||
static esp_err_t handleRootRequest(httpd_req_t* req);
|
||||
static esp_err_t handleApiRequest(httpd_req_t* req);
|
||||
};
|
||||
|
||||
#endif // WEB_SERVER_HPP
|
||||
Reference in New Issue
Block a user