2025-01-03 02:03:59 +00:00
|
|
|
#ifndef CHATWEBAPI_H
|
|
|
|
#define CHATWEBAPI_H
|
2025-01-02 06:45:53 +00:00
|
|
|
|
2025-01-02 22:11:45 +00:00
|
|
|
#include "mongoose.h"
|
2025-01-02 06:45:53 +00:00
|
|
|
#include "json_fwd.hpp"
|
2025-01-02 22:11:45 +00:00
|
|
|
#include "GeneralUtils.h"
|
|
|
|
|
2025-01-02 06:45:53 +00:00
|
|
|
using json = nlohmann::json;
|
|
|
|
|
|
|
|
class ChatWebAPI {
|
|
|
|
public:
|
2025-01-02 22:11:45 +00:00
|
|
|
ChatWebAPI();
|
2025-01-02 06:45:53 +00:00
|
|
|
~ChatWebAPI();
|
2025-01-02 22:11:45 +00:00
|
|
|
void ReceiveRequests();
|
2025-01-02 22:35:27 +00:00
|
|
|
void Listen();
|
2025-01-02 06:45:53 +00:00
|
|
|
private:
|
2025-01-02 22:11:45 +00:00
|
|
|
struct mg_mgr mgr;
|
|
|
|
static void HandleRequests(struct mg_connection *c, int ev, void *ev_data);
|
|
|
|
inline static const std::string root_path = "/api/v1/";
|
|
|
|
inline static const char * json_content_type = "Content-Type: application/json\r\n";
|
2025-01-02 06:45:53 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|