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#ifndef EXPRESS_ROUTE_H
43#define EXPRESS_ROUTE_H
45#include "express/MountPoint.h"
55 namespace dispatcher {
56 class RouterDispatcher;
60#ifndef DOXYGEN_SHOULD_SKIP_THIS
69#define DECLARE_ROUTE_REQUESTMETHOD(METHOD)
70 Route& METHOD(const std::function<void(const std::shared_ptr<Request>&, const std::shared_ptr<Response>&)>& lambda) const;
71 Route& METHOD(const std::function<void(const std::shared_ptr<Request>&, const std::shared_ptr<Response>&, Next&)>& lambda) const;
72 template <typename... Lambdas>
73 Route& METHOD(const std::function<void(const std::shared_ptr<Request>&, const std::shared_ptr<Response>&)>& lambda,
74 Lambdas... lambdas) const;
75 template <typename... Lambdas>
76 Route& METHOD(const std::function<void(const std::shared_ptr<Request>&, const std::shared_ptr<Response>&, Next&)>& lambda,
77 Lambdas... lambdas) const;
83 enum class StrictRouting { INHERIT, STRICT, LAX };
85 Route(
const std::string& method,
const std::string& relativeMountPath,
const std::shared_ptr<Dispatcher>& dispatcher);
87 Route& setStrictRouting(
bool strict =
true);
88 const StrictRouting& getStrictRouting()
const;
90 std::list<std::string> getRoute(
const std::string& parentMountPath,
bool strictRouting)
const;
95 bool dispatch(Controller& controller);
97 bool dispatch(Controller& controller,
const std::string& parentMountPath);
98 bool dispatchNext(Controller& controller,
const std::string& parentMountPath);
100 MountPoint mountPoint;
101 std::shared_ptr<Dispatcher> dispatcher;
103 StrictRouting strictRouting = StrictRouting::INHERIT;
118 friend class dispatcher::RouterDispatcher;
119 friend class Dispatcher;
120 friend class RootRoute;
121 friend class Controller;
126#include "express/Route.hpp"
#define DECLARE_ROOTROUTE_REQUESTMETHOD(METHOD)
#define DECLARE_ROUTE_REQUESTMETHOD(METHOD)
#define DECLARE_ROUTER_REQUESTMETHOD(METHOD)
static express::Router getRouter()
static WebApp getWebApp(const std::string &name)
static WebApp getWebApp(const std::string &name)
int main(int argc, char *argv[])