1
0
mirror of https://github.com/actix/actix-website synced 2025-06-27 07:29:02 +02:00
This commit is contained in:
Rob Ede
2020-09-12 16:21:54 +01:00
committed by GitHub
parent a0ce9f28e2
commit 4d8d53cea5
145 changed files with 1011 additions and 1461 deletions

View File

@ -4,9 +4,8 @@ version = "1.0.0"
edition = "2018"
[dependencies]
actix-web = "2.0"
actix-rt = "1.0"
actix-service = "1.0"
actix-session = "0.3"
futures = "0.3.1"
env_logger = "0.6"
actix-web = "3"
actix-service = "1"
actix-session = "0.4"
futures = "0.3"
env_logger = "0.7"

View File

@ -1,7 +1,7 @@
// <default-headers>
use actix_web::{http, middleware, HttpResponse};
#[actix_rt::main]
#[actix_web::main]
async fn main() -> std::io::Result<()> {
use actix_web::{web, App, HttpServer};
@ -17,7 +17,7 @@ async fn main() -> std::io::Result<()> {
),
)
})
.bind("127.0.0.1:8088")?
.bind("127.0.0.1:8080")?
.run()
.await
}

View File

@ -1,3 +1,5 @@
#![allow(dead_code)]
// <error-handler>
use actix_web::middleware::errhandlers::{ErrorHandlerResponse, ErrorHandlers};
use actix_web::{dev, http, HttpResponse, Result};
@ -10,7 +12,7 @@ fn render_500<B>(mut res: dev::ServiceResponse<B>) -> Result<ErrorHandlerRespons
Ok(ErrorHandlerResponse::Response(res))
}
#[actix_rt::main]
#[actix_web::main]
async fn main() -> std::io::Result<()> {
use actix_web::{web, App, HttpServer};
@ -26,7 +28,7 @@ async fn main() -> std::io::Result<()> {
.route(web::head().to(|| HttpResponse::MethodNotAllowed())),
)
})
.bind("127.0.0.1:8088")?
.bind("127.0.0.1:8080")?
.run()
.await
}

View File

@ -2,7 +2,7 @@
use actix_web::middleware::Logger;
use env_logger::Env;
#[actix_rt::main]
#[actix_web::main]
async fn main() -> std::io::Result<()> {
use actix_web::{App, HttpServer};
@ -13,7 +13,7 @@ async fn main() -> std::io::Result<()> {
.wrap(Logger::default())
.wrap(Logger::new("%a %{User-Agent}i"))
})
.bind("127.0.0.1:8088")?
.bind("127.0.0.1:8080")?
.run()
.await
}

View File

@ -74,7 +74,7 @@ where
}
// </simple>
#[actix_rt::main]
#[actix_web::main]
async fn main() -> std::io::Result<()> {
use actix_web::{web, App, HttpServer};
@ -86,7 +86,7 @@ async fn main() -> std::io::Result<()> {
}),
)
})
.bind("127.0.0.1:8088")?
.bind("127.0.0.1:8080")?
.run()
.await
}

View File

@ -1,3 +1,5 @@
#![allow(dead_code)]
// <user-session>
use actix_session::{CookieSession, Session};
use actix_web::{web, App, Error, HttpResponse, HttpServer};
@ -16,7 +18,7 @@ async fn index(session: Session) -> Result<HttpResponse, Error> {
)))
}
#[actix_rt::main]
#[actix_web::main]
async fn main() -> std::io::Result<()> {
HttpServer::new(|| {
App::new()
@ -26,7 +28,7 @@ async fn main() -> std::io::Result<()> {
)
.service(web::resource("/").to(index))
})
.bind("127.0.0.1:8088")?
.bind("127.0.0.1:8080")?
.run()
.await
}

View File

@ -1,9 +1,11 @@
#![allow(dead_code, unused_variables)]
// <wrap-fn>
use actix_service::Service;
use actix_web::{web, App};
use futures::future::FutureExt;
#[actix_rt::main]
#[actix_web::main]
async fn main() {
let app = App::new()
.wrap_fn(|req, srv| {