pub fn wrap<M>(
        self,
        mw: M,
    ) -> App<
        impl ServiceFactory<
            Config = (),
            Request = WebRequest<Err>,
            Response = WebResponse,
            Error = Err::Container,
            InitError = (),
        >,
        Err,
    >
    where
        M: Transform<
            T::Service,
            Request = WebRequest<Err>,
            Response = WebResponse,
            Error = Err::Container,
            InitError = (),
        >,
    {
        App {
            endpoint: apply(mw, self.endpoint),
            data: self.data,
            data_factories: self.data_factories,
            services: self.services,
            default: self.default,
            factory_ref: self.factory_ref,
            external: self.external,
            extensions: self.extensions,
            error_renderer: self.error_renderer,
            case_insensitive: self.case_insensitive,
        }
    }
/// Registers middleware, in the form of a middleware component (type),
/// that runs during inbound and/or outbound processing in the request
/// lifecycle (request -> response), modifying request/response as
/// necessary, across all requests managed by the *Application*.
///
/// Use middleware when you need to read or modify *every* request or
/// response in some way.
///
/// Notice that the keyword for registering middleware is `wrap`. As you
/// register middleware using `wrap` in the App builder,  imagine wrapping
/// layers around an inner App.  The first middleware layer exposed to a
/// Request is the outermost layer-- the *last* registered in
/// the builder chain.  Consequently, the *first* middleware registered
/// in the builder chain is the *last* to execute during request processing.
///
/// ```rust
/// use ntex::http::header::{CONTENT_TYPE, HeaderValue};
/// use ntex::web::{self, middleware, App};
///
/// async fn index() -> &'static str {
///     "Welcome!"
/// }
///
/// fn main() {
///     let app = App::new()
///         .wrap(middleware::Logger::default())
///         .route("/index.html", web::get().to(index));
/// }
/// ```
Registers middleware, in the form of a middleware component (type),
that runs during inbound and/or outbound processing in the request
lifecycle (request -> response), modifying request/response as
necessary, across all requests managed by the *Application*.

Use middleware when you need to read or modify *every* request or
response in some way.

Notice that the keyword for registering middleware is `wrap`. As you
register middleware using `wrap` in the App builder,  imagine wrapping
layers around an inner App.  The first middleware layer exposed to a
Request is the outermost layer-- the *last* registered in
the builder chain.  Consequently, the *first* middleware registered
in the builder chain is the *last* to execute during request processing.



async fn index() -> &'static str {
"Welcome!"
}


Registers middleware in the form of a middleware component ( type ) that runs during inbound and / or outbound processing in the request lifecycle ( request - > response ) modifying request / response as necessary across all requests managed by the * Application * . Use middleware when you need to read or modify * every * request or response in some way . Notice that the keyword for registering middleware is ` wrap ` . As you register middleware using ` wrap ` in the App builder imagine wrapping layers around an inner App . The first middleware layer exposed to a Request is the outermost layer -- the * last * registered in the builder chain . Consequently the * first * middleware registered in the builder chain is the * last * to execute during request processing . async fn index () - > & ' static str { " Welcome! " }
pub fn wrap<M>(
        self,
        mw: M,
    ) -> App<
        impl ServiceFactory<
            Config = (),
            Request = WebRequest<Err>,
            Response = WebResponse,
            Error = Err::Container,
            InitError = (),
        >,
        Err,
    >
    where
        M: Transform<
            T::Service,
            Request = WebRequest<Err>,
            Response = WebResponse,
            Error = Err::Container,
            InitError = (),
        >,
    {
        App {
            endpoint: apply(mw, self.endpoint),
            data: self.data,
            data_factories: self.data_factories,
            services: self.services,
            default: self.default,
            factory_ref: self.factory_ref,
            external: self.external,
            extensions: self.extensions,
            error_renderer: self.error_renderer,
            case_insensitive: self.case_insensitive,
        }
    }
pub fn wrap < M > ( self , mw : M , ) -> App < impl ServiceFactory < Config = ( ) , Request = WebRequest < Err > , Response = WebResponse , Error = Err :: Container , InitError = ( ) , > , Err , > where M : Transform < T :: Service , Request = WebRequest < Err > , Response = WebResponse , Error = Err :: Container , InitError = ( ) , > , { App { endpoint : apply ( mw , self . endpoint ) , data : self . data , data_factories : self . data_factories , services : self . services , default : self . default , factory_ref : self . factory_ref , external : self . external , extensions : self . extensions , error_renderer : self . error_renderer , case_insensitive : self . case_insensitive , } }
Registers middleware, in the form of a middleware component (type),
that runs during inbound and/or outbound processing in the request
lifecycle (request -> response), modifying request/response as
necessary, across all requests managed by the *Application*.
Registers middleware in the form of a middleware component ( type ) that runs during inbound and / or outbound processing in the request lifecycle ( request - > response ) modifying request / response as necessary across all requests managed by the * Application * .
self
mw
M