1
0
mirror of https://github.com/actix/actix-website synced 2025-02-02 04:09:06 +01:00
Marvin f786600af3
fix typo (#474)
* fix typo

* fix another typo
2024-10-15 19:02:25 +00:00

25 lines
510 B
Rust

#![allow(dead_code, unused_variables)]
// <from-fn>
use actix_web::{
body::MessageBody,
dev::{ServiceRequest, ServiceResponse},
middleware::{from_fn, Next},
App, Error,
};
async fn my_middleware(
req: ServiceRequest,
next: Next<impl MessageBody>,
) -> Result<ServiceResponse<impl MessageBody>, Error> {
// pre-processing
next.call(req).await
// post-processing
}
#[actix_web::main]
async fn main() {
let app = App::new().wrap(from_fn(my_middleware));
}
// </from-fn>