2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
42#include "express/legacy/in6/WebApp.h"
43#include "express/middleware/BasicAuthentication.h"
44#include "express/middleware/StaticMiddleware.h"
45#include "express/middleware/VHost.h"
46#include "express/tls/in6/WebApp.h"
47#include "utils/Config.h"
49#ifndef DOXYGEN_SHOULD_SKIP_THIS
51#include "log/Logger.h"
57using namespace express;
63 router.use(
middleware::StaticMiddleware(webRoot));
68int main(
int argc,
char* argv[]) {
82 legacyApp.use(router1);
86 res->
send("Hello! I am VHOST jupiter.home.vchrist.at.");
88 legacyApp.use(router2);
96 const core::socket::
State& state) {
99 VLOG(1) << instanceName <<
": listening on '" << socketAddress
.toString() <<
"'";
102 VLOG(1) << instanceName <<
": disabled";
105 LOG(ERROR) << instanceName <<
": " << socketAddress
.toString() <<
": " << state
.what();
108 LOG(FATAL) << instanceName <<
": " << socketAddress
.toString() <<
": " << state
.what();
122 res->
send("Hello! I am VHOST jupiter.home.vchrist.at.");
131 tlsApp
.listen(8088
, [](
const legacy::
in6::
WebApp::SocketAddress& socketAddress,
const core::socket::
State& state) {
134 VLOG(1) <<
"tls: listening on '" << socketAddress
.toString() <<
"'"
138 VLOG(1) <<
"tls: disabled";
141 VLOG(1) <<
"tls: error occurred";
144 VLOG(1) <<
"tls: fatal error occurred";
#define APPLICATION(req, res)
Config & getConfig() const
static constexpr int DISABLED
static constexpr int ERROR
static constexpr int FATAL
void send(const std::string &chunk)
Response & status(int status)
WebAppT(const std::string &name)
static void init(int argc, char *argv[])
static int start(const utils::Timeval &timeOut={LONG_MAX, 0})
friend class BasicAuthentication & BasicAuthentication(const std::string &userName, const std::string &password, const std::string &realm)
const std::string & getInstanceName() const
std::string toString(bool expanded=true) const override
const Super & listen(uint16_t port, const std::function< void(const SocketAddress &, core::socket::State)> &onStatus) const
static CLI::Option * addStringOption(const std::string &name, const std::string &description, const std::string &typeName)
static std::string getStringOptionValue(const std::string &name)
int main(int argc, char *argv[])
WebAppT< web::http::legacy::in6::Server > WebApp
WebAppT< web::http::tls::in6::Server > WebApp
Router getRouter(const std::string &webRoot)