/// Create an API to handle doc requests
Create an API to handle doc requests
Create an API to handle doc requests
pub fn create_api(path: &str) -> framework::Api {
    framework::Api::build(|api| {
        api.namespace(path, |docs| {
            docs.get("", |endpoint| {
                endpoint.summary("Get Swagger 2.0 specification of this API");
                endpoint.handle(|mut client, _params| {
                    client.set_header(header::AccessControlAllowOrigin::Any);
                    let swagger_spec = client.app.ext.get::<SwaggerSpecKey>();
                    if swagger_spec.is_some() {
                        client.json(swagger_spec.unwrap())
                    } else {
                        client.empty()
                    }
                })
            })
        })
    })
}
pub fn create_api ( path : & str ) -> framework :: Api { framework :: Api :: build ( | api | { api . namespace ( path , | docs | { docs . get ( " " , | endpoint | { endpoint . summary ( " " ) ; endpoint . handle ( | mut client , _params | { client . set_header ( header :: AccessControlAllowOrigin :: Any ) ; let swagger_spec = client . app . ext . get :: < SwaggerSpecKey > ( ) ; if swagger_spec . is_some ( ) { client . json ( swagger_spec . unwrap ( ) ) } else { client . empty ( ) } } ) } ) } ) } ) }
Create an API to handle doc requests
Create an API to handle doc requests
path
&str