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/StaticMiddleware.h"
45#include "express/middleware/VHost.h"
46#include "express/tls/in6/WebApp.h"
48#ifndef DOXYGEN_SHOULD_SKIP_THIS
50#include "log/Logger.h"
51#include "utils/Config.h"
55using namespace express;
60 router.use(
middleware::StaticMiddleware(webRoot));
65int main(
int argc,
char* argv[]) {
80 if (req->
query("how").empty()) {
82 }
else if (req->
query("how") ==
"route") {
84 }
else if (req->
query("how") ==
"router") {
89 res->
send("Hello! I am VHOST jupiter.home.vchrist.at.");
96 if (req->
query("how").empty()) {
98 }
else if (req->
query("how") ==
"route") {
100 }
else if (req->
query("how") ==
"router") {
105 res->
send("Hello! I am VHOST atlas.home.vchrist.at.");
108 res->
send("Hello, next route on atlas.home.vchrist.at");
111 res->
send("Test Route on VHOST atlas.home.vchrist.at.");
121 const core::socket::
State& state) {
124 VLOG(1) << instanceName <<
" listening on '" << socketAddress
.toString() <<
"'";
127 VLOG(1) << instanceName <<
" disabled";
149 if (req->
query("how").empty()) {
151 }
else if (req->
query("how") ==
"route") {
153 }
else if (req->
query("how") ==
"router") {
158 res->
send("Hello! I am VHOST atlas.home.vchrist.at.");
165 if (req->
query("how").empty()) {
167 }
else if (req->
query("how") ==
"route") {
169 }
else if (req->
query("how") ==
"router") {
174 res->
send("Hello! I am VHOST ceres.home.vchrist.at.");
177 res->
send("Hello, next route on ceres.home.vchrist.at");
180 res->
send("Test Route on VHOST ceres.home.vchrist.at.");
190 const core::socket::
State& state) {
193 VLOG(1) << instanceName <<
" listening on '" << socketAddress
.toString() <<
"'";
196 VLOG(1) << instanceName <<
" disabled";
207 tlsApp
.getConfig()->setCert("/home/voc/projects/snodec/snode.c/certs/wildcard.home.vchrist.at_-_snode.c_-_server.pem");
209 "/home/voc/projects/snodec/snode.c/certs/Volker_Christian_-_Web_-_snode.c_-_server.key.encrypted.pem");
#define APPLICATION(req, res)
#define MIDDLEWARE(req, res, next)
Config * getConfig() const
static constexpr int DISABLED
static constexpr int ERROR
static constexpr int FATAL
void operator()(const std::string &how="") const
const std::string & query(const std::string &key) const
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})
LogMessage(Level level, int verboseLevel=-1, bool withErrno=false)
const std::string & getInstanceName() const
ConfigTls * setCertKey(const std::string &certKey)
ConfigTls * setCert(const std::string &cert)
ConfigTls * setCertKeyPassword(const std::string &certKeyPassword)
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)