Skip to main content

typeway_api

Macro typeway_api 

Source
typeway_api!() { /* proc-macro */ }
Expand description

Defines a complete API type with inline route definitions.

§Syntax

typeway_api! {
    type MyAPI = {
        GET "users" => Json<Vec<User>>,
        GET "users" / u32 => Json<User>,
        POST "users" [Json<CreateUser>] => Json<User>,
        DELETE "users" / u32 => StatusCode,
    };
}
  • Methods: GET, POST, PUT, DELETE, PATCH, HEAD, OPTIONS
  • Request body is specified in [brackets] (optional, only for POST/PUT/PATCH)
  • Response type follows =>