linker errors

This commit is contained in:
Aaron Kimbre
2025-01-26 00:44:17 -06:00
parent eeb7b68a3b
commit 848c930292
17 changed files with 424 additions and 351 deletions

56
dWeb/Web.h Normal file
View File

@@ -0,0 +1,56 @@
#ifndef __WEB_H__
#define __WEB_H__
#include <functional>
#include <string>
#include <optional>
#include "mongoose.h"
#include "json_fwd.hpp"
#include "eHTTPStatusCode.h"
enum class eHTTPMethod;
typedef struct mg_mgr mg_mgr;
struct HTTPReply {
eHTTPStatusCode status = eHTTPStatusCode::NOT_FOUND;
std::string message = "{\"error\":\"Not Found\"}";
};
struct HTTPRoute {
std::string path;
eHTTPMethod method;
std::function<void(HTTPReply&, const std::string&)> handle;
};
struct WSAction {
std::string action;
std::function<void(mg_connection*, nlohmann::json)> handle;
};
struct WSMessage {
uint32_t id;
std::string sub;
std::string message;
};
class Web {
public:
Web();
~Web();
void ReceiveRequests();
void static SendWSMessage(std::string sub, const std::string& message);
bool Startup(const std::string& listen_ip, const uint32_t listen_port);
void RegisterHTTPRoute(HTTPRoute route);
void RegisterWSAction(WSAction action);
private:
mg_mgr mgr;
};
namespace Game {
Web web;
}
#endif // !__WEB_H__