ゴミ箱
|
#include <router.hpp>
Public Member Functions | |
Route (const char *path, router_handler fn) | |
std::optional< matches > | match (const char *uri) const |
std::optional< matches > | match (boost::beast::string_view uri) const |
Public Attributes | |
router_handler | callback |
Route's handler. More... | |
HTTP Route class
Router::Route::Route | ( | const char * | path, |
router_handler | fn | ||
) |
Creates instance of route.
[in] | path | Path to match against. |
[in] | fn | Callback 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.
std::optional< Router::matches > Router::Route::match | ( | const char * | uri | ) | const |
Performs match against URI.
[in] | uri | HTTP URI. |
std::nullopt | On 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
router_handler http::Router::Route::callback |
Route's handler.