SNode.C
Loading...
Searching...
No Matches
Router.hpp
Go to the documentation of this file.
1/*
2 * SNode.C - A Slim Toolkit for Network Communication
3 * Copyright (C) 2020, 2021, 2022 Volker Christian <me@vchrist.at>
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU Lesser General Public License as published
7 * by the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19/*
20 * MIT License
21 *
22 * Permission is hereby granted, free of charge, to any person obtaining a copy
23 * of this software and associated documentation files (the "Software"), to deal
24 * in the Software without restriction, including without limitation the rights
25 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
26 * copies of the Software, and to permit persons to whom the Software is
27 * furnished to do so, subject to the following conditions:
28 *
29 * The above copyright notice and this permission notice shall be included in
30 * all copies or substantial portions of the Software.
31 *
32 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
33 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
34 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
35 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
36 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
37 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
38 * THE SOFTWARE.
39 */
40
41#ifndef EXPRESS_ROUTER_HPP
42#define EXPRESS_ROUTER_HPP
43
44// IWYU pragma: no_include "express/Router.h"
45
46#ifndef DOXYGEN_SHOULD_SKIP_THIS
47
48#include <memory> // IWYU pragma: export
49#include <string>
50
51#endif /* DOXYGEN_SHOULD_SKIP_THIS */
52
53#define DEFINE_ROUTER_TEMPLATE_REQUESTMETHOD(METHOD, HTTP_METHOD)
54 template <typename... Lambdas>
55 Route& Router::METHOD(const std::string& relativeMountPath,
56 const std::function<void(const std::shared_ptr<Request>&, const std::shared_ptr<Response>&, Next&)>& lambda,
57 Lambdas... lambdas) const {
58 return rootRoute->METHOD(relativeMountPath, lambda).METHOD(lambdas...);
59 }
60 template <typename... Lambdas>
61 Route& Router::METHOD(const std::function<void(const std::shared_ptr<Request>&, const std::shared_ptr<Response>&, Next&)>& lambda,
62 Lambdas... lambdas) const {
63 return rootRoute->METHOD(lambda).METHOD(lambdas...);
64 }
65 template <typename... Lambdas>
66 Route& Router::METHOD(const std::string& relativeMountPath,
67 const std::function<void(const std::shared_ptr<Request>&, const std::shared_ptr<Response>&)>& lambda,
68 Lambdas... lambdas) const {
69 return rootRoute->METHOD(relativeMountPath, lambda).METHOD(lambdas...);
70 }
71 template <typename... Lambdas>
72 Route& Router::METHOD(const std::function<void(const std::shared_ptr<Request>&, const std::shared_ptr<Response>&)>& lambda,
73 Lambdas... lambdas) const {
74 return rootRoute->METHOD(lambda).METHOD(lambdas...);
75 }
76
77namespace express {
78
90
91} // namespace express
92
93#endif // EXPRESS_ROUTER_HPP
#define DECLARE_ROOTROUTE_REQUESTMETHOD(METHOD)
Definition RootRoute.h:68
#define DECLARE_ROUTE_REQUESTMETHOD(METHOD)
Definition Route.h:69
#define DEFINE_ROUTE_TEMPLATE_REQUESTMETHOD(METHOD, HTTP_METHOD)
Definition Route.hpp:61
#define DECLARE_ROUTER_REQUESTMETHOD(METHOD)
Definition Router.h:71
#define DEFINE_ROUTER_TEMPLATE_REQUESTMETHOD(METHOD, HTTP_METHOD)
Definition Router.hpp:53
#define QUOTE_INCLUDE(a)
Definition clients.h:47
#define STR_INCLUDE(a)
Definition servers.h:48
static express::Router getRouter()
Definition servers.h:68
static WebApp getWebApp(const std::string &name)
Definition servers.h:79
static WebApp getWebApp(const std::string &name)
Definition servers.h:96
Definition Config.h:59
int main(int argc, char *argv[])