RESTinio
|
Generic Express.js style router. More...
#include <express.hpp>
Public Types | |
using | actual_request_handle_t = generic_request_handle_t< typename Extra_Data_Factory::data_t > |
using | actual_request_handler_t = typename generic_express_route_entry_t< Regex_Engine, Extra_Data_Factory >::actual_request_handler_t |
using | non_matched_handler_t = generic_non_matched_request_handler_t< typename Extra_Data_Factory::data_t > |
Private Types | |
using | route_entry_t = generic_express_route_entry_t< Regex_Engine, Extra_Data_Factory > |
Private Attributes | |
std::vector< route_entry_t > | m_handlers |
A list of existing routes. | |
non_matched_handler_t | m_non_matched_request_handler |
Handler that is called for requests that don't match any route. | |
Generic Express.js style router.
Express routers acts as a request handler (it means it is a function-object that can be called as a restinio request handler). It aggregates several endpoint-handlers and picks one or none of them to handle the request. The choice of the handler to execute depends on request target and HTTP method.
If router finds no handler matching the request then request is considered unmatched.
It is possible to set a handler for unmatched requests, otherwise router rejects the request and RESTinio takes care of it.
There is a difference between ordinary restinio request handler and the one that is used with experss router: generic_express_request_handler_t. The signature of a handlers that can be put in router has an additional parameter – a container with parameters extracted from URI (request target).
Regex_Engine | Type of regex-engine to be used. |
Extra_Data_Factory | Type of extra-data-factory specified in server's traits. |
Definition at line 611 of file express.hpp.
using restinio::router::generic_express_router_t< Regex_Engine, Extra_Data_Factory >::actual_request_handle_t = generic_request_handle_t< typename Extra_Data_Factory::data_t > |
Definition at line 614 of file express.hpp.
using restinio::router::generic_express_router_t< Regex_Engine, Extra_Data_Factory >::actual_request_handler_t = typename generic_express_route_entry_t< Regex_Engine, Extra_Data_Factory >::actual_request_handler_t |
Definition at line 616 of file express.hpp.
using restinio::router::generic_express_router_t< Regex_Engine, Extra_Data_Factory >::non_matched_handler_t = generic_non_matched_request_handler_t< typename Extra_Data_Factory::data_t > |
Definition at line 621 of file express.hpp.
|
private |
Definition at line 815 of file express.hpp.
|
default |
|
default |
|
inline |
Add handlers.
Definition at line 659 of file express.hpp.
|
inline |
Definition at line 673 of file express.hpp.
|
inline |
Definition at line 687 of file express.hpp.
|
inline |
Definition at line 698 of file express.hpp.
|
inline |
Definition at line 711 of file express.hpp.
|
inline |
Definition at line 722 of file express.hpp.
|
inline |
Definition at line 735 of file express.hpp.
|
inline |
Definition at line 746 of file express.hpp.
|
inline |
Definition at line 759 of file express.hpp.
|
inline |
Definition at line 770 of file express.hpp.
|
inline |
Definition at line 783 of file express.hpp.
|
inline |
Definition at line 794 of file express.hpp.
|
inline |
Set handler for requests that don't match any route.
Definition at line 809 of file express.hpp.
|
inline |
Definition at line 631 of file express.hpp.
|
private |
A list of existing routes.
Definition at line 821 of file express.hpp.
|
private |
Handler that is called for requests that don't match any route.
Definition at line 824 of file express.hpp.