remove api

This commit is contained in:
chatlanin 2024-08-04 12:29:13 +03:00
parent 09d3025003
commit 19b43a3bba
3 changed files with 4 additions and 9 deletions

View File

@ -73,24 +73,17 @@ namespace trs
}
}
void set_api_url(std::string url)
{
API_URL = url;
}
private:
std::string m_service_name;
bool m_log_to_console { true };
function_manager<transaction> m_function_manager;
inspector<transaction> m_inspector;
std::string API_URL { "/" };
private:
void set_CORS()
{
Options(R"(\*)", [](const auto& req, auto& res) { res.set_header("Allow", "POST, HEAD, OPTIONS"); });
Options(API_URL, [](const auto& req, auto& res)
Options(var::API_URL, [](const auto& req, auto& res)
{
res.set_header("Access-Control-Allow-Origin", "*");
res.set_header("Allow", "POST, HEAD, OPTIONS");
@ -101,7 +94,7 @@ namespace trs
void set_post()
{
Post(API_URL, [&](const httplib::Request& req, httplib::Response& res) {
Post(var::API_URL, [&](const httplib::Request& req, httplib::Response& res) {
res.set_header("Access-Control-Allow-Origin", "*");
res.set_header("Access-Control-Allow-Headers", "*");
res.set_header("Access-Control-Allow-Methods", "POST");

View File

@ -6,6 +6,7 @@ namespace trs::var
{
inline const int PORT = 5000;
inline const std::string HOST = "0.0.0.0";
inline const std::string API_URL = "/";
inline const std::string ALIEN_SYSTEM_ERROR = "is alien system error it can be very dangerous!!! good luck my friend!";
inline const std::string NO_VALID_DATA = "no valid data";

View File

@ -53,6 +53,7 @@ auto main(int argc, char* args[]) -> int
trs::server srv;
srv.init("test service");
srv.set_api_url("/api");
srv.registration("healthcheck", worckspaces::inspector, worckspaces::provider);
srv.run();