RESTinio
Public Member Functions | Private Types | Private Attributes | List of all members
restinio::router::express_router_t< Regex_Engine > Class Template Reference

Express.js style router. More...

#include <express.hpp>

Public Member Functions

 express_router_t ()=default
 
 express_router_t (express_router_t &&)=default
 
RESTINIO_NODISCARD request_handling_status_t operator() (request_handle_t req) const
 
void non_matched_request_handler (non_matched_request_handler_t nmrh)
 Set handler for requests that don't match any route. More...
 
template<typename Method_Matcher >
void add_handler (Method_Matcher &&method_matcher, string_view_t route_path, express_request_handler_t handler)
 Add handlers. More...
 
template<typename Method_Matcher >
void add_handler (Method_Matcher &&method_matcher, string_view_t route_path, const path2regex::options_t &options, express_request_handler_t handler)
 
void http_delete (string_view_t route_path, express_request_handler_t handler)
 
void http_delete (string_view_t route_path, const path2regex::options_t &options, express_request_handler_t handler)
 
void http_get (string_view_t route_path, express_request_handler_t handler)
 
void http_get (string_view_t route_path, const path2regex::options_t &options, express_request_handler_t handler)
 
void http_head (string_view_t route_path, express_request_handler_t handler)
 
void http_head (string_view_t route_path, const path2regex::options_t &options, express_request_handler_t handler)
 
void http_post (string_view_t route_path, express_request_handler_t handler)
 
void http_post (string_view_t route_path, const path2regex::options_t &options, express_request_handler_t handler)
 
void http_put (string_view_t route_path, express_request_handler_t handler)
 
void http_put (string_view_t route_path, const path2regex::options_t &options, express_request_handler_t handler)
 

Private Types

using route_entry_t = express_route_entry_t< Regex_Engine >
 

Private Attributes

std::vector< route_entry_tm_handlers
 A list of existing routes. More...
 
non_matched_request_handler_t m_non_matched_request_handler
 Handler that is called for requests that don't match any route. More...
 

Detailed Description

template<typename Regex_Engine = std_regex_engine_t>
class restinio::router::express_router_t< Regex_Engine >

Express.js style router.

Examples
sample/file_upload/main.cpp, sample/hello_world/main.cpp, and sample/websocket_wss/main.cpp.

Definition at line 537 of file express.hpp.

Member Typedef Documentation

◆ route_entry_t

template<typename Regex_Engine = std_regex_engine_t>
using restinio::router::express_router_t< Regex_Engine >::route_entry_t = express_route_entry_t< Regex_Engine >
private

Definition at line 729 of file express.hpp.

Constructor & Destructor Documentation

◆ express_router_t() [1/2]

template<typename Regex_Engine = std_regex_engine_t>
restinio::router::express_router_t< Regex_Engine >::express_router_t ( )
default

◆ express_router_t() [2/2]

template<typename Regex_Engine = std_regex_engine_t>
restinio::router::express_router_t< Regex_Engine >::express_router_t ( express_router_t< Regex_Engine > &&  )
default

Member Function Documentation

◆ add_handler() [1/2]

template<typename Regex_Engine = std_regex_engine_t>
template<typename Method_Matcher >
void restinio::router::express_router_t< Regex_Engine >::add_handler ( Method_Matcher &&  method_matcher,
string_view_t  route_path,
const path2regex::options_t options,
express_request_handler_t  handler 
)
inline

Definition at line 587 of file express.hpp.

◆ add_handler() [2/2]

template<typename Regex_Engine = std_regex_engine_t>
template<typename Method_Matcher >
void restinio::router::express_router_t< Regex_Engine >::add_handler ( Method_Matcher &&  method_matcher,
string_view_t  route_path,
express_request_handler_t  handler 
)
inline

Add handlers.

Definition at line 573 of file express.hpp.

◆ http_delete() [1/2]

template<typename Regex_Engine = std_regex_engine_t>
void restinio::router::express_router_t< Regex_Engine >::http_delete ( string_view_t  route_path,
const path2regex::options_t options,
express_request_handler_t  handler 
)
inline

Definition at line 612 of file express.hpp.

◆ http_delete() [2/2]

template<typename Regex_Engine = std_regex_engine_t>
void restinio::router::express_router_t< Regex_Engine >::http_delete ( string_view_t  route_path,
express_request_handler_t  handler 
)
inline

Definition at line 601 of file express.hpp.

◆ http_get() [1/2]

template<typename Regex_Engine = std_regex_engine_t>
void restinio::router::express_router_t< Regex_Engine >::http_get ( string_view_t  route_path,
const path2regex::options_t options,
express_request_handler_t  handler 
)
inline

Definition at line 636 of file express.hpp.

◆ http_get() [2/2]

template<typename Regex_Engine = std_regex_engine_t>
void restinio::router::express_router_t< Regex_Engine >::http_get ( string_view_t  route_path,
express_request_handler_t  handler 
)
inline

Definition at line 625 of file express.hpp.

◆ http_head() [1/2]

template<typename Regex_Engine = std_regex_engine_t>
void restinio::router::express_router_t< Regex_Engine >::http_head ( string_view_t  route_path,
const path2regex::options_t options,
express_request_handler_t  handler 
)
inline

Definition at line 660 of file express.hpp.

◆ http_head() [2/2]

template<typename Regex_Engine = std_regex_engine_t>
void restinio::router::express_router_t< Regex_Engine >::http_head ( string_view_t  route_path,
express_request_handler_t  handler 
)
inline

Definition at line 649 of file express.hpp.

◆ http_post() [1/2]

template<typename Regex_Engine = std_regex_engine_t>
void restinio::router::express_router_t< Regex_Engine >::http_post ( string_view_t  route_path,
const path2regex::options_t options,
express_request_handler_t  handler 
)
inline

Definition at line 684 of file express.hpp.

◆ http_post() [2/2]

template<typename Regex_Engine = std_regex_engine_t>
void restinio::router::express_router_t< Regex_Engine >::http_post ( string_view_t  route_path,
express_request_handler_t  handler 
)
inline

Definition at line 673 of file express.hpp.

◆ http_put() [1/2]

template<typename Regex_Engine = std_regex_engine_t>
void restinio::router::express_router_t< Regex_Engine >::http_put ( string_view_t  route_path,
const path2regex::options_t options,
express_request_handler_t  handler 
)
inline

Definition at line 708 of file express.hpp.

◆ http_put() [2/2]

template<typename Regex_Engine = std_regex_engine_t>
void restinio::router::express_router_t< Regex_Engine >::http_put ( string_view_t  route_path,
express_request_handler_t  handler 
)
inline

Definition at line 697 of file express.hpp.

◆ non_matched_request_handler()

template<typename Regex_Engine = std_regex_engine_t>
void restinio::router::express_router_t< Regex_Engine >::non_matched_request_handler ( non_matched_request_handler_t  nmrh)
inline

Set handler for requests that don't match any route.

Definition at line 723 of file express.hpp.

◆ operator()()

template<typename Regex_Engine = std_regex_engine_t>
RESTINIO_NODISCARD request_handling_status_t restinio::router::express_router_t< Regex_Engine >::operator() ( request_handle_t  req) const
inline

Definition at line 545 of file express.hpp.

Member Data Documentation

◆ m_handlers

template<typename Regex_Engine = std_regex_engine_t>
std::vector< route_entry_t > restinio::router::express_router_t< Regex_Engine >::m_handlers
private

A list of existing routes.

Definition at line 732 of file express.hpp.

◆ m_non_matched_request_handler

template<typename Regex_Engine = std_regex_engine_t>
non_matched_request_handler_t restinio::router::express_router_t< Regex_Engine >::m_non_matched_request_handler
private

Handler that is called for requests that don't match any route.

Definition at line 735 of file express.hpp.


The documentation for this class was generated from the following file: