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/Route.h"
44#include "express/Controller.h"
45#include "express/dispatcher/ApplicationDispatcher.h"
46#include "express/dispatcher/MiddlewareDispatcher.h"
47#include "express/dispatcher/RouterDispatcher.h"
49#ifndef DOXYGEN_SHOULD_SKIP_THIS
55#define DEFINE_ROUTE_REQUESTMETHOD(METHOD, HTTP_METHOD)
56 Route& Route::METHOD(const std::function<void(const std::shared_ptr<Request>&, const std::shared_ptr<Response>&, Next&)>& lambda)
58 return *(dispatcher->nextRoute = std::make_shared<Route>(
59 HTTP_METHOD, mountPoint.relativeMountPath, std::make_shared<dispatcher::MiddlewareDispatcher>(lambda)))
63 Route& Route::METHOD(const std::function<void(const std::shared_ptr<Request>&, const std::shared_ptr<Response>&)>& lambda) const {
64 return *(dispatcher->nextRoute = std::make_shared<Route>(
65 HTTP_METHOD, mountPoint.relativeMountPath, std::make_shared<dispatcher::ApplicationDispatcher>(lambda)))
77 Route::
Route(
const std::string& method,
const std::string& relativeMountPath,
const std::shared_ptr<
Dispatcher>& dispatcher)
88 dispatched = controller
.dispatchNext(strictRouting
, caseInsensitiveRouting
, mergeParams
);
98 std::list<std::string>
Route::
getRoute(
const std::string& parentMountPath,
bool strictRouting)
const {
#define DEFINE_ROUTE_REQUESTMETHOD(METHOD, HTTP_METHOD)
bool dispatchNext(bool strictRouting, bool caseInsensitiveRouting, bool mergeParams)
void setCurrentRoute(Route *currentRoute)
virtual bool dispatch(Controller &controller, const MountPoint &mountPoint, bool strictRouting, bool caseInsensitiveRouting, bool mergeParams)=0
bool dispatchNext(Controller &controller, bool strictRouting, bool caseInsensitiveRouting, bool mergeParams)
virtual std::list< std::string > getRoutes(const std::string &parentMountPath, const MountPoint &mountPoint, bool strictRouting) const =0
std::shared_ptr< Dispatcher > dispatcher
bool dispatchNext(Controller &controller, bool strictRouting, bool caseInsensitiveRouting, bool mergeParams)
Route(const std::string &method, const std::string &relativeMountPath, const std::shared_ptr< Dispatcher > &dispatcher)
std::list< std::string > getRoute(const std::string &parentMountPath, bool strictRouting) const
bool dispatch(Controller &controller, bool strictRouting, bool caseInsensitiveRouting, bool mergeParams)
MountPoint(const std::string &method, const std::string &relativeMountPath)