#ifndef ApiServer_hpp #define ApiServer_hpp #include "oatpp/web/server/HttpConnectionHandler.hpp" #include "oatpp/network/tcp/server/ConnectionProvider.hpp" #include "oatpp/core/macro/component.hpp" #include "oatpp-swagger/Resources.hpp" #include "oatpp/parser/json/mapping/ObjectMapper.hpp" #include "oatpp-swagger/Model.hpp" class ApiServer { public: OATPP_CREATE_COMPONENT(std::shared_ptr, serverConnectionProvider)([] { return oatpp::network::tcp::server::ConnectionProvider::createShared({"0.0.0.0", 8000, oatpp::network::Address::IP_4}); }()); OATPP_CREATE_COMPONENT(std::shared_ptr, httpRouter)([] { return oatpp::web::server::HttpRouter::createShared(); }()); OATPP_CREATE_COMPONENT(std::shared_ptr, serverConnectionHandler)([] { OATPP_COMPONENT(std::shared_ptr, router); return oatpp::web::server::HttpConnectionHandler::createShared(router); }()); OATPP_CREATE_COMPONENT(std::shared_ptr, apiObjectMapper)([] { return oatpp::parser::json::mapping::ObjectMapper::createShared(); }()); OATPP_CREATE_COMPONENT(std::shared_ptr, swaggerResources)([] { return oatpp::swagger::Resources::loadResources(OATPP_SWAGGER_RES_PATH); }()); }; #endif /* ApiServer_hpp */