SNode.C
Loading...
Searching...
No Matches
express::tls::in Namespace Reference

Typedefs

using WebApp = WebAppT< web::http::tls::in::Server >
 

Functions

WebApp Server (const std::string &instanceName, const express::Router &router, const std::function< void(const std::string &, WebApp::SocketAddress, const core::socket::State &)> &reportState, const std::function< void(typename WebApp::Config &)> &configurator)
 
WebApp Server (const std::string &instanceName, const Router &router, const std::function< void(WebApp::Config &)> &configurator)
 
WebApp Server (const std::string &instanceName, const express::Router &router, const std::function< void(typename WebApp::Config &)> &configurator)
 

Typedef Documentation

◆ WebApp

Definition at line 54 of file WebApp.h.

Function Documentation

◆ Server() [1/3]

WebApp express::tls::in::Server ( const std::string &  instanceName,
const express::Router router,
const std::function< void(const std::string &, WebApp::SocketAddress, const core::socket::State &)> &  reportState = nullptr,
const std::function< void(typename WebApp::Config &)> &  configurator = nullptr 
)

Definition at line 55 of file Server.cpp.

58 {
59 using SocketAddress = typename WebApp::SocketAddress;
60
61 const WebApp webApp(instanceName, router);
62
63 if (configurator != nullptr) {
64 configurator(webApp.getConfig());
65 }
66
67 webApp.listen([instanceName, reportState](const SocketAddress& socketAddress, const core::socket::State& state) {
68 if (reportState != nullptr) {
69 reportState(instanceName, socketAddress, state);
70 } else {
71 switch (state) {
73 VLOG(1) << instanceName << ": listening on '" << socketAddress.toString() << "'";
74 break;
76 VLOG(1) << instanceName << ": disabled";
77 break;
79 VLOG(1) << instanceName << ": " << socketAddress.toString() << ": " << state.what();
80 break;
82 VLOG(1) << instanceName << ": " << socketAddress.toString() << ": " << state.what();
83 break;
84 }
85 }
86 });
87
88 VLOG(1) << "Instance: " << instanceName;
89 for (std::string& route : webApp.getRoutes()) {
90 route.erase(std::remove(route.begin(), route.end(), '$'), route.end());
91
92 VLOG(1) << " " << route;
93 }
94
95 return webApp;
96 }
static constexpr int DISABLED
Definition State.h:56
static constexpr int ERROR
Definition State.h:57
std::string what() const
Definition State.cpp:114
static constexpr int FATAL
Definition State.h:58
static constexpr int OK
Definition State.h:55
typename Server::SocketAddress SocketAddress
Definition WebAppT.h:70
Router router(database::mariadb::MariaDBClient &db)
Definition testregex.cpp:68

References core::socket::State::DISABLED, core::socket::State::ERROR, core::socket::State::FATAL, core::socket::Socket< ConfigT >::getConfig(), express::Router::getRoutes(), core::socket::stream::SocketServer< SocketAcceptorT, SocketContextFactoryT, Args >::listen(), core::socket::State::OK, net::in::SocketAddress::toString(), express::WebAppT< ServerT >::WebAppT(), and core::socket::State::what().

Referenced by Server().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Server() [2/3]

WebApp express::tls::in::Server ( const std::string &  instanceName,
const express::Router router,
const std::function< void(typename WebApp::Config &)> &  configurator 
)

◆ Server() [3/3]

WebApp express::tls::in::Server ( const std::string &  instanceName,
const Router router,
const std::function< void(WebApp::Config &)> &  configurator 
)

Definition at line 98 of file Server.cpp.

98 {
99 return Server(instanceName, router, nullptr, configurator);
100 }

References Server().

Here is the call graph for this function: