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/RootRoute.h"
44#include "express/Controller.h"
45#include "express/Response.h"
46#include "express/dispatcher/ApplicationDispatcher.h"
47#include "express/dispatcher/MiddlewareDispatcher.h"
48#include "express/dispatcher/RouterDispatcher.h"
50#ifndef DOXYGEN_SHOULD_SKIP_THIS
57#define DEFINE_ROOTROUTE_REQUESTMETHOD(METHOD, HTTP_METHOD)
58 Route& RootRoute::METHOD(const RootRoute& rootRoute) const {
59 return routes().emplace_back(HTTP_METHOD, "", rootRoute.getDispatcher());
61 Route& RootRoute::METHOD(const std::string& relativeMountPath, const RootRoute& rootRoute) const {
62 return routes().emplace_back(HTTP_METHOD, relativeMountPath, rootRoute.getDispatcher());
64 Route& RootRoute::METHOD(const std::string& relativeMountPath,
65 const std::function<void(const std::shared_ptr<Request>&, const std::shared_ptr<Response>&, Next&)>& lambda)
67 return routes().emplace_back(HTTP_METHOD, relativeMountPath, std::make_shared<dispatcher::MiddlewareDispatcher>(lambda));
69 Route& RootRoute::METHOD(const std::function<void(const std::shared_ptr<Request>&, const std::shared_ptr<Response>&, Next&)>& lambda)
71 return routes().emplace_back(HTTP_METHOD, "", std::make_shared<dispatcher::MiddlewareDispatcher>(lambda));
73 Route& RootRoute::METHOD(const std::string& relativeMountPath,
74 const std::function<void(const std::shared_ptr<Request>&, const std::shared_ptr<Response>&)>& lambda) const {
75 return routes().emplace_back(HTTP_METHOD, relativeMountPath, std::make_shared<dispatcher::ApplicationDispatcher>(lambda));
77 Route& RootRoute::METHOD(const std::function<void(const std::shared_ptr<Request>&, const std::shared_ptr<Response>&)>& lambda) const {
78 return routes().emplace_back(HTTP_METHOD, "", std::make_shared<dispatcher::ApplicationDispatcher>(lambda));
100 return oldStrictRouting;
110 const bool oldStrictRoute =
#define DEFINE_ROOTROUTE_REQUESTMETHOD(METHOD, HTTP_METHOD)
bool setStrictRouting(bool strictRouting)
void setRootRoute(RootRoute *rootRoute)
const std::shared_ptr< Response > & getResponse()
void sendStatus(int state)
void dispatch(Controller &&controller)
void dispatch(Controller &controller)
bool setStrictRouting(bool strictRouting)
std::list< std::string > getRoutes() const
std::list< Route > & routes() const
std::shared_ptr< dispatcher::RouterDispatcher > getDispatcher() const
std::shared_ptr< Dispatcher > dispatcher
bool dispatch(Controller &controller)
std::list< std::string > getRoutes(const std::string &parentMountPath, const MountPoint &mountPoint) const
bool setStrictRouting(bool strictRouting)
std::list< express::Route > & getRoutes()
bool getStrictRouting() const