1 #include "OdbServerAppBase.h"
3 #include "RequestAuthenticationBase.h"
7 #include "OdbAppBase.h"
12 using namespace Utils;
13 using namespace std::filesystem;
15 namespace Odb::Lib::App
17 OdbServerAppBase::OdbServerAppBase(
int argc,
char* argv[])
18 : OdbAppBase(argc, argv)
22 bool OdbServerAppBase::preServerRun()
28 bool OdbServerAppBase::postServerRun()
34 OdbServerAppBase::~OdbServerAppBase()
36 m_vecControllers.clear();
39 ExitCode OdbServerAppBase::Run()
45 return ExitCode::Success;
49 if (ExitCode::Success != OdbAppBase::Run())
return ExitCode::FailedInit;
52 m_crowApp.loglevel(crow::LogLevel::Info);
55 m_crowApp.use_compression(crow::compression::algorithm::GZIP);
88 m_crowApp.port(
static_cast<unsigned short>(args().port()));
91 m_crowApp.multithreaded();
93 if (!preServerRun())
return ExitCode::PreServerRunFailed;
98 if (!postServerRun())
return ExitCode::PostServerRunFailed;
101 return ExitCode::Success;
104 CrowApp& OdbServerAppBase::crow_app()
109 RequestAuthenticationBase& OdbServerAppBase::request_auth()
111 return *m_pRequestAuthentication;
114 void OdbServerAppBase::request_auth(std::unique_ptr<RequestAuthenticationBase> pRequestAuthentication)
116 m_pRequestAuthentication = std::move(pRequestAuthentication);
119 void OdbServerAppBase::register_routes()
121 for (
const auto& pController : m_vecControllers)
123 pController->register_routes();