|
| generic_easy_parser_router_t ()=default |
|
| generic_easy_parser_router_t (const generic_easy_parser_router_t &)=delete |
|
generic_easy_parser_router_t & | operator= (const generic_easy_parser_router_t &)=delete |
|
| generic_easy_parser_router_t (generic_easy_parser_router_t &&)=default |
|
generic_easy_parser_router_t & | operator= (generic_easy_parser_router_t &&)=default |
|
RESTINIO_NODISCARD request_handling_status_t | operator() (actual_request_handle_t req) const |
|
template<typename Method_Matcher , typename Route_Producer , typename Handler > |
void | add_handler (Method_Matcher &&method_matcher, Route_Producer &&route, Handler &&handler) |
|
template<typename Route_Producer , typename Handler > |
void | http_get (Route_Producer &&route, Handler &&handler) |
| Set handler for HTTP GET request.
|
|
template<typename Route_Producer , typename Handler > |
void | http_delete (Route_Producer &&route, Handler &&handler) |
| Set handler for HTTP DELETE request.
|
|
template<typename Route_Producer , typename Handler > |
void | http_head (Route_Producer &&route, Handler &&handler) |
| Set handler for HTTP HEAD request.
|
|
template<typename Route_Producer , typename Handler > |
void | http_post (Route_Producer &&route, Handler &&handler) |
| Set handler for HTTP POST request.
|
|
template<typename Route_Producer , typename Handler > |
void | http_put (Route_Producer &&route, Handler &&handler) |
| Set handler for HTTP PUT request.
|
|
void | non_matched_request_handler (generic_non_matched_request_handler_t< extra_data_t > nmrh) |
| Set handler for requests that don't match any route.
|
|
A generic request router that uses easy_parser for matching requests with handlers.
- Note
- That type is intended to be used when extra-data-factory for server traits is not the default one. If your server uses the default extra-data-factory then easy_parser_router_t should be used for the simplicity.
Usage example:
struct data_t {...};
new(buf.
get()) data_t{...};
}
};
auto router = std::make_unique<router_t>();
...
router->http_get(epr::path_to_params(...),
[](
const auto &
req, ...) {...});
router->http_post(epr::path_to_params(...),
[](
const auto &
req, ...) {...});
router->http_delete(epr::path_to_params(...),
[](
const auto &
req, ...) {...});
router->add_handler(
epr::path_to_params(...),
[](
const auto &
req, ...) {...});
router->add_handler(
epr::path_to_params(...),
[](
const auto &
req, ...) {...});
router->add_handler(
epr::path_to_params(...),
[](
const auto &
req, ...) {...});
return router;
}
...
}
...
restinio::run(
...
);
A generic request router that uses easy_parser for matching requests with handlers.
RESTINIO_NODISCARD impl::fixed_size_any_of_matcher_t< sizeof...(Args) > any_of_methods(Args &&...args)
A factory function that creates a method_matcher that allows a method if it's found in the list of al...
RESTINIO_NODISCARD impl::fixed_size_none_of_matcher_t< sizeof...(Args) > none_of_methods(Args &&...args)
A factory function that creates a method_matcher that allows a method if it isn't found in the list o...
run_on_this_thread_settings_t< Traits > on_this_thread()
A special marker for the case when http_server must be run on the context of the current thread.
- Template Parameters
-
Extra_Data_Factory | The type of user-type-factory. This type should be the same as the traits::user_type_factory_t type for the server. |
- Since
- v.0.6.6, v.0.6.13
Definition at line 949 of file easy_parser_router.hpp.