46 {
48
50
51 {
53
55
58
60 legacyApp.
use(router1);
61
64 res->send("Hello! I am VHOST ceres.home.vchrist.at.");
65 });
66 legacyApp.
use(router2);
67
69 res->status(404).
send(
"The requested resource is not found.");
70 });
71
72 legacyApp.listen(8080,
75 switch (state) {
76 case core::socket::State::OK:
77 VLOG(1) << instanceName << ": listening on '" << socketAddress.toString() << "'";
78 break;
79 case core::socket::State::DISABLED:
80 VLOG(1) << instanceName << ": disabled";
81 break;
82 case core::socket::State::ERROR:
83 LOG(ERROR) << instanceName << ": " << socketAddress.toString() << ": " << state.what();
84 break;
85 case core::socket::State::FATAL:
86 LOG(FATAL) << instanceName << ": " << socketAddress.toString() << ": " << state.what();
87 break;
88 }
89 });
90
91 {
93
97
100 res->send("Hello! I am VHOST ceres.home.vchrist.at.");
101 });
102
104
106 res->status(404).
send(
"The requested resource is not found.");
107 });
108
110 switch (state) {
112 VLOG(1) << "tls: listening on '" << socketAddress.toString() << "'"
113 << "'";
114 break;
116 VLOG(1) << "tls: disabled";
117 break;
119 VLOG(1) << "tls: error occurred";
120 break;
122 VLOG(1) << "tls: fatal error occurred";
123 break;
124 }
125 });
126 }
127 }
128
130}
#define APPLICATION(req, res)
static constexpr int DISABLED
static constexpr int ERROR
static constexpr int FATAL
Route & use(const std::function< void(const std::shared_ptr< Request > &, const std::shared_ptr< Response > &)> &lambda) const
Route & get(const Router &router) const
typename Server::SocketAddress SocketAddress
static void init(int argc, char *argv[])
static int start(const utils::Timeval &timeOut={LONG_MAX, 0})
static CLI::Option * addStringOption(const std::string &name, const std::string &description, const std::string &typeName)
static std::string getStringOptionValue(const std::string &name)
static express::Router getRouter()
ssize_t send(int sockfd, const void *buf, std::size_t len, int flags)
class VHost & VHost(const std::string &host)
class BasicAuthentication & BasicAuthentication(const std::string &userName, const std::string &password, const std::string &realm)