api_get

Function api_get 

Source
pub fn api_get<HandlerParams, ApiParams, H>(handler: H) -> ApiMethodRouter
where HandlerParams: 'static, ApiParams: 'static, H: RequestHandler<HandlerParams> + AsApiOperation<ApiParams> + Send + Sync + 'static,
Available on crate feature openapi only.
Expand description

Create a new ApiMethodRouter with a GET handler.

This is a shorthand to call ApiMethodRouter::new and then ApiMethodRouter::get.

ยงExamples

use cot::json::Json;
use cot::router::method::openapi::api_get;

async fn test_handler() -> Json<()> {
    Json(())
}

let method_router = api_get(test_handler);