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
43#include "express/legacy/in6/WebApp.h"
44#include "express/middleware/BasicAuthentication.h"
45#include "express/middleware/StaticMiddleware.h"
46#include "express/middleware/VHost.h"
47#include "express/tls/in6/WebApp.h"
48#include "utils/Config.h"
50#ifndef DOXYGEN_SHOULD_SKIP_THIS
52#include "log/Logger.h"
56using namespace express;
62 router.use(
middleware::StaticMiddleware(webRoot));
67int main(
int argc,
char* argv[]) {
83 legacyServer.use(router1);
87 res->
send("Hello! I am VHOST jupiter.home.vchrist.at.");
89 legacyServer.use(router2);
97 const core::socket::
State& state) {
100 VLOG(1) << instanceName <<
": listening on '" << socketAddress
.toString() <<
"'";
103 VLOG(1) << instanceName <<
": disabled";
124 res->
send("Hello! I am VHOST jupiter.home.vchrist.at.");
133 tlsServer
.listen(8088
, [](
const legacy::
in6::
WebApp::SocketAddress& socketAddress,
const core::socket::
State& state) {
140 VLOG(1) <<
"tls: disabled";
143 VLOG(1) <<
"tls: error occurred";
146 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)
LogMessage(Level level, int verboseLevel=-1, bool withErrno=false)
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
std::string getHtmlRoot()
static ConfigRoot configRoot
NewSubCommand * newSubCommand(Args &&... args)
RequestedSubCommand * getSubCommand()
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)