mirror of
https://github.com/actix/actix-extras.git
synced 2025-06-26 02:19:22 +02:00
rename Application
This commit is contained in:
@ -9,7 +9,7 @@
|
||||
//! 2. Use any of the builder methods to set fields in the backend.
|
||||
//! 3. Call [finish](struct.Cors.html#method.finish) to retrieve the constructed backend.
|
||||
//!
|
||||
//! Cors middleware could be used as parameter for `Application::middleware()` or
|
||||
//! Cors middleware could be used as parameter for `App::middleware()` or
|
||||
//! `Resource::middleware()` methods. But you have to use `Cors::register()` method to
|
||||
//! support *preflight* OPTIONS request.
|
||||
//!
|
||||
@ -18,7 +18,7 @@
|
||||
//!
|
||||
//! ```rust
|
||||
//! # extern crate actix_web;
|
||||
//! use actix_web::{http, Application, HttpRequest, HttpResponse};
|
||||
//! use actix_web::{http, App, HttpRequest, HttpResponse};
|
||||
//! use actix_web::middleware::cors;
|
||||
//!
|
||||
//! fn index(mut req: HttpRequest) -> &'static str {
|
||||
@ -26,7 +26,7 @@
|
||||
//! }
|
||||
//!
|
||||
//! fn main() {
|
||||
//! let app = Application::new()
|
||||
//! let app = App::new()
|
||||
//! .resource("/index.html", |r| {
|
||||
//! cors::Cors::build() // <- Construct CORS middleware
|
||||
//! .allowed_origin("https://www.rust-lang.org/")
|
||||
|
@ -22,7 +22,7 @@
|
||||
//!
|
||||
//! ```
|
||||
//! # extern crate actix_web;
|
||||
//! use actix_web::{http, Application, HttpRequest, HttpResponse};
|
||||
//! use actix_web::{http, App, HttpRequest, HttpResponse};
|
||||
//! use actix_web::middleware::csrf;
|
||||
//!
|
||||
//! fn handle_post(_: HttpRequest) -> &'static str {
|
||||
@ -30,7 +30,7 @@
|
||||
//! }
|
||||
//!
|
||||
//! fn main() {
|
||||
//! let app = Application::new()
|
||||
//! let app = App::new()
|
||||
//! .middleware(
|
||||
//! csrf::CsrfFilter::build()
|
||||
//! .allowed_origin("https://www.example.com")
|
||||
|
@ -13,10 +13,10 @@ use middleware::{Response, Middleware};
|
||||
///
|
||||
/// ```rust
|
||||
/// # extern crate actix_web;
|
||||
/// use actix_web::{http, middleware, Application, HttpResponse};
|
||||
/// use actix_web::{http, middleware, App, HttpResponse};
|
||||
///
|
||||
/// fn main() {
|
||||
/// let app = Application::new()
|
||||
/// let app = App::new()
|
||||
/// .middleware(
|
||||
/// middleware::DefaultHeaders::build()
|
||||
/// .header("X-Version", "0.2")
|
||||
|
@ -29,14 +29,14 @@ use middleware::{Middleware, Started, Finished};
|
||||
/// ```rust
|
||||
/// # extern crate actix_web;
|
||||
/// extern crate env_logger;
|
||||
/// use actix_web::Application;
|
||||
/// use actix_web::App;
|
||||
/// use actix_web::middleware::Logger;
|
||||
///
|
||||
/// fn main() {
|
||||
/// std::env::set_var("RUST_LOG", "actix_web=info");
|
||||
/// env_logger::init();
|
||||
///
|
||||
/// let app = Application::new()
|
||||
/// let app = App::new()
|
||||
/// .middleware(Logger::default())
|
||||
/// .middleware(Logger::new("%a %{User-Agent}i"))
|
||||
/// .finish();
|
||||
|
@ -114,11 +114,11 @@ unsafe impl Sync for SessionImplBox {}
|
||||
/// ```rust
|
||||
/// # extern crate actix;
|
||||
/// # extern crate actix_web;
|
||||
/// # use actix_web::middleware::{SessionStorage, CookieSessionBackend};
|
||||
/// use actix_web::*;
|
||||
/// use actix_web::App;
|
||||
/// use actix_web::middleware::{SessionStorage, CookieSessionBackend};
|
||||
///
|
||||
/// fn main() {
|
||||
/// let app = Application::new().middleware(
|
||||
/// let app = App::new().middleware(
|
||||
/// SessionStorage::new( // <- create session middleware
|
||||
/// CookieSessionBackend::build(&[0; 32]) // <- create cookie session backend
|
||||
/// .secure(false)
|
||||
|
Reference in New Issue
Block a user