ゴミ箱
Public Member Functions | Public Attributes | List of all members
http::Router::Route Class Reference

#include <router.hpp>

Public Member Functions

 Route (const char *path, router_handler fn)
 
std::optional< matchesmatch (const char *uri) const
 
std::optional< matchesmatch (boost::beast::string_view uri) const
 

Public Attributes

router_handler callback
 Route's handler. More...
 

Detailed Description

HTTP Route class

Constructor & Destructor Documentation

Router::Route::Route ( const char *  path,
router_handler  fn 
)

Creates instance of route.

Parameters
[in]pathPath to match against.
[in]fnCallback to invoke on match.

Path can be either regex or string like /:some where element :some will be returned as part of Context in field matches. The some will be key of the match.

Member Function Documentation

std::optional< Router::matches > Router::Route::match ( const char *  uri) const

Performs match against URI.

Parameters
[in]uriHTTP URI.
Returns
Matches.
Return values
std::nulloptOn no match.
std::optional< Router::matches > Router::Route::match ( boost::beast::string_view  uri) const

Performs match against URI.

Version that accepts boost::beast::string_view

Member Data Documentation

router_handler http::Router::Route::callback

Route's handler.


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