mirror of
https://github.com/actix/examples
synced 2024-11-23 14:31:07 +01:00
refactor: switch from_fn to stable version
This commit is contained in:
parent
431ebe8c2b
commit
e962a2a9b1
@ -1,11 +1,10 @@
|
||||
use actix_web::{
|
||||
body::{self, MessageBody},
|
||||
dev::{self, ServiceResponse},
|
||||
middleware::Logger,
|
||||
middleware::{from_fn, Logger, Next},
|
||||
web::{self, Data, Json},
|
||||
App, Error, HttpServer, Responder,
|
||||
};
|
||||
use actix_web_lab::middleware::{from_fn, Next};
|
||||
use aes_gcm_siv::{aead::Aead as _, Aes256GcmSiv, KeyInit as _, Nonce};
|
||||
use base64::prelude::*;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
@ -33,4 +33,4 @@ A minimal middleware demonstrating the sequence of operations in an actix middle
|
||||
|
||||
## See Also
|
||||
|
||||
- The `from_fn` middleware constructor from [`actix-web-lab`](https://crates.io/crates/actix-web-lab).
|
||||
- The [`from_fn` middleware constructor](https://docs.rs/actix-web/4/actix_web/middleware/fn.from_fn.html).
|
||||
|
@ -1,16 +1,18 @@
|
||||
use std::time::Duration;
|
||||
|
||||
use actix_http::body::MessageBody;
|
||||
use actix_web::{dev, rt::time, web, App, Error, HttpServer};
|
||||
use actix_web_lab::middleware::{from_fn, Next};
|
||||
use actix_web::{
|
||||
body::MessageBody,
|
||||
dev,
|
||||
middleware::{from_fn, Next},
|
||||
rt::time,
|
||||
web, App, Error, HttpServer,
|
||||
};
|
||||
|
||||
mod read_request_body;
|
||||
mod read_response_body;
|
||||
mod redirect;
|
||||
mod simple;
|
||||
|
||||
// See more examples of from_fn middleware here:
|
||||
// https://github.com/robjtede/actix-web-lab/blob/main/actix-web-lab/examples/from_fn.rs
|
||||
async fn timeout_10secs(
|
||||
req: dev::ServiceRequest,
|
||||
next: Next<impl MessageBody + 'static>,
|
||||
|
@ -1,7 +1,7 @@
|
||||
use std::io;
|
||||
|
||||
use actix_web::{App, HttpServer};
|
||||
use actix_web_lab::{extract::ThinData, middleware::from_fn};
|
||||
use actix_web::{middleware::from_fn, App, HttpServer};
|
||||
use actix_web_lab::extract::ThinData;
|
||||
use tracing_actix_web::TracingLogger;
|
||||
|
||||
mod logging;
|
||||
|
Loading…
Reference in New Issue
Block a user