RESTinio
|
Generic Express.js style router. More...
#include <express.hpp>
Public Types | |
using | actual_request_handle_t |
using | actual_request_handler_t |
using | non_matched_handler_t |
Private Types | |
using | route_entry_t |
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 614 of file express.hpp.
using restinio::router::generic_express_router_t< Regex_Engine, Extra_Data_Factory >::actual_request_handle_t |
Definition at line 617 of file express.hpp.
using restinio::router::generic_express_router_t< Regex_Engine, Extra_Data_Factory >::actual_request_handler_t |
Definition at line 619 of file express.hpp.
using restinio::router::generic_express_router_t< Regex_Engine, Extra_Data_Factory >::non_matched_handler_t |
Definition at line 624 of file express.hpp.
|
private |
Definition at line 818 of file express.hpp.
|
default |
|
default |
|
inline |
Add handlers.
Definition at line 662 of file express.hpp.
|
inline |
Definition at line 676 of file express.hpp.
|
inline |
Definition at line 690 of file express.hpp.
|
inline |
Definition at line 701 of file express.hpp.
|
inline |
Definition at line 714 of file express.hpp.
|
inline |
Definition at line 725 of file express.hpp.
|
inline |
Definition at line 738 of file express.hpp.
|
inline |
Definition at line 749 of file express.hpp.
|
inline |
Definition at line 762 of file express.hpp.
|
inline |
Definition at line 773 of file express.hpp.
|
inline |
Definition at line 786 of file express.hpp.
|
inline |
Definition at line 797 of file express.hpp.
|
inline |
Set handler for requests that don't match any route.
Definition at line 812 of file express.hpp.
|
inline |
Definition at line 634 of file express.hpp.
|
private |
A list of existing routes.
Definition at line 824 of file express.hpp.
|
private |
Handler that is called for requests that don't match any route.
Definition at line 827 of file express.hpp.