blob: 2a389c931e7124c248d081fa1243c49c79f31d0e (
about) (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
module;
#include <boost/asio/awaitable.hpp>
export module routemon:srv;
import :api;
import :http.server;
import :rwgps;
namespace routemon::srv {
class handler
{
log::logger l_;
api::handler inner_;
std::shared_ptr<rwgps::credentials> rwgps_creds_;
public:
using outer_ctx = http::base_ctx;
using l0_ctx = http::routed_ctx<outer_ctx>;
private:
auto handle_process_gpx(l0_ctx ctx, http::readable_request r)
-> net::awaitable<http::presponse>;
auto handle_sysinfo(l0_ctx ctx, http::readable_request r)
-> net::awaitable<http::presponse>;
auto handle_rwgps_webhook(l0_ctx ctx, http::readable_request r)
-> net::awaitable<http::presponse>;
public:
handler(
log::logger const& l, api::handler&& inner,
std::shared_ptr<rwgps::credentials> rwgps_creds);
auto make_routes() -> http::route_tree<http::routed_ctx<outer_ctx>>;
};
export class server
{
handler handler_;
http::server srv_;
static auto make_global_middleware(config::http_server const& cfg)
-> http::middleware_t<http::base_ctx, handler::outer_ctx>;
public:
server(
log::logger const& l, config::http_server const& cfg,
std::shared_ptr<rwgps::credentials> rwgps_creds, locale::selector&& lsel,
api::handler&& inner);
auto spawn(net::io_context& ioc) -> void;
};
} // namespace routemon::srv
|