Macro fire_http_api::custom_request_handler
source · [−]macro_rules! custom_request_handler {
(
async fn $name:ident( $($ptt:tt)* ) $($tt:tt)*
) => { ... };
(
async fn $name:ident<$data_ty:ty>($req:ident: $req_ty:ty) $($tt:tt)*
) => { ... };
(
async fn $name:ident<$data_ty:ty>(
$req:ident: $req_ty:ty,
$($data:ident),*
) -> $ret_ty:ty $block:block
) => { ... };
}Expand description
A macro to easely create an http route.
where req does not contain the parsed json but a whole fire::request::Request this allows to have a different body than the json but have the benefit of the api structure of error reporting etc…
Example
ⓘ
request_handler! {
async fn name(req: Request, any_data) -> Result<Response, Error> {}
}