patch

Attribute Macro patch 

Source
#[patch]
Expand description

Defines a handler for PATCH DELETE requests. This macro should be used inside an impl block of a struct annotated with the #[controller] macro.

§Parameters

  • path: The path for the PATCH request, e.g., "/item/{id}"

§Usage

#[controller("/api")]
struct MyController {}

#[routes]
impl MyController {
    #[patch("/item/{id}")]
    async fn patch_item(&self, req: Request) -> HttpResult<HttpResponse> {
        Ok(HttpResponse::Ok().message("Item patched"))
    }
}