mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-13 10:31:29 +00:00
Sidecar stuff wont directly include cpp files now too.
This commit is contained in:
parent
76f8f1fb95
commit
0815aea6fd
@ -1,18 +0,0 @@
|
|||||||
void SidecarApi::RequestLogHandler(const httplib::Request &req, const httplib::Response &res)
|
|
||||||
{
|
|
||||||
if (!req.path.empty()) {
|
|
||||||
std::vector<std::string> params;
|
|
||||||
for (auto &p: req.params) {
|
|
||||||
params.emplace_back(fmt::format("{}={}", p.first, p.second));
|
|
||||||
}
|
|
||||||
|
|
||||||
LogInfo(
|
|
||||||
"[API] Request [{}] [{}{}] via [{}:{}]",
|
|
||||||
res.status,
|
|
||||||
req.path,
|
|
||||||
(!params.empty() ? "?" + Strings::Join(params, "&") : ""),
|
|
||||||
req.remote_addr,
|
|
||||||
req.remote_port
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,4 +0,0 @@
|
|||||||
void SidecarApi::MapBestZController(const httplib::Request &req, httplib::Response &res)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -16,9 +16,39 @@ void CatchSidecarSignal(int sig_num)
|
|||||||
std::exit(0);
|
std::exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
#include "log_handler.cpp"
|
void SidecarApi::RequestLogHandler(const httplib::Request& req, const httplib::Response& res)
|
||||||
#include "test_controller.cpp"
|
{
|
||||||
#include "map_best_z_controller.cpp"
|
if (!req.path.empty()) {
|
||||||
|
std::vector<std::string> params;
|
||||||
|
for (auto& p : req.params) {
|
||||||
|
params.emplace_back(fmt::format("{}={}", p.first, p.second));
|
||||||
|
}
|
||||||
|
|
||||||
|
LogInfo(
|
||||||
|
"[API] Request [{}] [{}{}] via [{}:{}]",
|
||||||
|
res.status,
|
||||||
|
req.path,
|
||||||
|
(!params.empty() ? "?" + Strings::Join(params, "&") : ""),
|
||||||
|
req.remote_addr,
|
||||||
|
req.remote_port
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void SidecarApi::TestController(const httplib::Request& req, httplib::Response& res)
|
||||||
|
{
|
||||||
|
nlohmann::json j;
|
||||||
|
|
||||||
|
j["data"]["test"] = "test";
|
||||||
|
|
||||||
|
res.set_content(j.dump(), "application/json");
|
||||||
|
}
|
||||||
|
|
||||||
|
void SidecarApi::MapBestZController(const httplib::Request& req, httplib::Response& res)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
#include "../../common/file.h"
|
#include "../../common/file.h"
|
||||||
|
|
||||||
constexpr static int HTTP_RESPONSE_OK = 200;
|
constexpr static int HTTP_RESPONSE_OK = 200;
|
||||||
|
|||||||
@ -1,10 +0,0 @@
|
|||||||
#include "sidecar_api.h"
|
|
||||||
|
|
||||||
void SidecarApi::TestController(const httplib::Request &req, httplib::Response &res)
|
|
||||||
{
|
|
||||||
nlohmann::json j;
|
|
||||||
|
|
||||||
j["data"]["test"] = "test";
|
|
||||||
|
|
||||||
res.set_content(j.dump(), "application/json");
|
|
||||||
}
|
|
||||||
Loading…
x
Reference in New Issue
Block a user