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/in/WebApp.h"
43#include "express/middleware/StaticMiddleware.h"
44#include "log/Logger.h"
48int main(
int argc,
char* argv[]) {
50 const express::legacy::in::WebApp app
("OAuth2Client");
54 if (!req->
query("code").empty()) {
55 res->
sendFile("/home/rathalin/projects/snode.c/src/oauth2/client_app/vue-frontend-oauth2-client/dist/index.html",
58 PLOG(ERROR) << req->
url;
62
63
64
65
66
67
68
69
70
71
72
76 app.use(express::middleware::StaticMiddleware(
"/home/rathalin/projects/snode.c/src/oauth2/client_app/vue-frontend-oauth2-client/dist"));
78 app
.listen(8081
, [](
const express::legacy::in::WebApp::SocketAddress& socketAddress,
const core::socket::
State& state) {
81 VLOG(1) <<
"OAuth2Client: connected to '" << socketAddress
.toString() <<
"'";
84 VLOG(1) <<
"OAuth2Client: disabled";
87 VLOG(1) <<
"OAuth2Client: error occurred";
90 VLOG(1) <<
"OAuth2Client: fatal error occurred";
#define APPLICATION(req, res)
static constexpr int DISABLED
static constexpr int ERROR
static constexpr int FATAL
const std::string & query(const std::string &key) const
void sendFile(const std::string &file, const std::function< void(int)> &callback)
WebAppT(const std::string &name)
static void init(int argc, char *argv[])
static int start(const utils::Timeval &timeOut={LONG_MAX, 0})
std::string toString(bool expanded=true) const override
void listen(uint16_t port, const std::function< void(const SocketAddress &, core::socket::State)> &onStatus) const
int main(int argc, char *argv[])