actix-web
actix-web copied to clipboard
Does actix-web-codegen support attribute macros to GUARD of cusomized definition ??
trafficstars
Discussed in https://github.com/actix/actix-web/discussions/3140
Originally posted by TQLeung September 20, 2023 Dos actix-web-codegen support attribute macros to GUARD of cusomized definition ??
Can you give me an example of the code you want to write?
Can you give me an example of the code you want to write? @robjtede
something like this, thanks. can be one guard or array of guard.
guard(["crate::my_gruad::TokenGuard1","crate::my_gruad::TokenGuard2"])
web::scope("/recipe")
.service(item)
#[get("/item/{id}"), guard(["crate::my_gruad::TokenGuard1","crate::my_gruad::TokenGuard2"])] // HERE ! ^_^
pub async fn item(
app: web::Data<AppState>
) -> impl Responder {
......
}