mirror of
https://gitee.com/zyjblog/oatpp.git
synced 2024-12-22 22:16:37 +08:00
Added url/router-prefix to ApiController
This commit is contained in:
parent
7cf4d9e769
commit
0dc3743a05
@ -288,7 +288,7 @@ std::shared_ptr<Endpoint::Info> Z__EDNPOINT_INFO_GET_INSTANCE_##NAME() { \
|
||||
EndpointInfoBuilder Z__CREATE_ENDPOINT_INFO_##NAME = [this](){ \
|
||||
auto info = Z__EDNPOINT_INFO_GET_INSTANCE_##NAME(); \
|
||||
info->name = #NAME; \
|
||||
info->path = PATH; \
|
||||
info->path = ((m_routerPrefix != nullptr) ? m_routerPrefix + PATH : PATH); \
|
||||
info->method = METHOD; \
|
||||
return info; \
|
||||
}; \
|
||||
@ -317,7 +317,7 @@ std::shared_ptr<oatpp::web::protocol::http::outgoing::Response> NAME()
|
||||
EndpointInfoBuilder Z__CREATE_ENDPOINT_INFO_##NAME = [this](){ \
|
||||
auto info = Z__EDNPOINT_INFO_GET_INSTANCE_##NAME(); \
|
||||
info->name = #NAME; \
|
||||
info->path = PATH; \
|
||||
info->path = ((m_routerPrefix != nullptr) ? m_routerPrefix + PATH : PATH); \
|
||||
info->method = METHOD; \
|
||||
OATPP_MACRO_FOREACH(OATPP_MACRO_API_CONTROLLER_FOR_EACH_PARAM_INFO, __VA_ARGS__) \
|
||||
return info; \
|
||||
|
@ -279,11 +279,13 @@ protected:
|
||||
std::shared_ptr<oatpp::data::mapping::ObjectMapper> m_defaultObjectMapper;
|
||||
std::unordered_map<std::string, std::shared_ptr<Endpoint::Info>> m_endpointInfo;
|
||||
std::unordered_map<std::string, std::shared_ptr<RequestHandler>> m_endpointHandlers;
|
||||
const oatpp::String m_routerPrefix;
|
||||
public:
|
||||
ApiController(const std::shared_ptr<oatpp::data::mapping::ObjectMapper>& defaultObjectMapper)
|
||||
ApiController(const std::shared_ptr<oatpp::data::mapping::ObjectMapper>& defaultObjectMapper, const oatpp::String &routerPrefix = nullptr)
|
||||
: m_endpoints(Endpoints::createShared())
|
||||
, m_errorHandler(nullptr)
|
||||
, m_defaultObjectMapper(defaultObjectMapper)
|
||||
, m_routerPrefix(routerPrefix)
|
||||
{}
|
||||
public:
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user