From 8741cd32cc0da75b2eae031bf00da8bd1d87bbac Mon Sep 17 00:00:00 2001 From: Lunush <76045303+lunush@users.noreply.github.com> Date: Fri, 9 Apr 2021 16:39:50 +0300 Subject: [PATCH] Minor README fixes (#174) --- actix-identity/README.md | 8 ++++---- actix-redis/README.md | 26 ++++++++++++-------------- 2 files changed, 16 insertions(+), 18 deletions(-) diff --git a/actix-identity/README.md b/actix-identity/README.md index 6fc34622e..9ed752300 100644 --- a/actix-identity/README.md +++ b/actix-identity/README.md @@ -2,10 +2,10 @@ > Identity service for actix-web framework. -[![crates.io](https://img.shields.io/crates/v/actix-cors?label=latest)](https://crates.io/crates/actix-cors) -[![Documentation](https://docs.rs/actix-cors/badge.svg?version=0.4.0-beta.1)](https://docs.rs/actix-cors/0.4.0-beta.1) -![Apache 2.0 or MIT licensed](https://img.shields.io/crates/l/actix-cors) -[![Dependency Status](https://deps.rs/crate/actix-cors/0.4.0-beta.1/status.svg)](https://deps.rs/crate/actix-cors/0.4.0-beta.1) +[![crates.io](https://img.shields.io/crates/v/actix-identity?label=latest)](https://crates.io/crates/actix-identity) +[![Documentation](https://docs.rs/actix-identity/badge.svg?version=0.4.0-beta.1)](https://docs.rs/actix-identity/0.4.0-beta.1) +![Apache 2.0 or MIT licensed](https://img.shields.io/crates/l/actix-identity) +[![Dependency Status](https://deps.rs/crate/actix-identity/0.4.0-beta.1/status.svg)](https://deps.rs/crate/actix-identity/0.4.0-beta.1) ## Documentation & community resources diff --git a/actix-redis/README.md b/actix-redis/README.md index 0514520ac..7db718de3 100644 --- a/actix-redis/README.md +++ b/actix-redis/README.md @@ -9,7 +9,7 @@ ## Documentation & Resources -- [API Documentation](https://docs.rs/actix-cors) +- [API Documentation](https://docs.rs/actix-redis) - [Example Project](https://github.com/actix/examples/tree/HEAD/session/redis-session) - Minimum Supported Rust Version (MSRV): 1.46 @@ -26,24 +26,22 @@ Note that whatever you write into your session is visible by the user (but not m Constructor panics if key length is less than 32 bytes. ```rust -use actix_web::{App, HttpServer, web, middleware}; -use actix_web::middleware::session::SessionStorage; +use actix_web::{App, HttpServer, middleware::Logger}; +use actix_web::web::{resource, get} use actix_redis::RedisSession; -#[actix_rt::main] -async fn main() -> std::io::Result { - HttpServer::new(|| App::new() - // enable logger - .middleware(middleware::Logger::default()) +#[actix_web::main] +async fn main() -> std::io::Result<()> { + HttpServer::new(move || App::new() // cookie session middleware - .middleware(SessionStorage::new( - RedisSession::new("127.0.0.1:6379", &[0; 32]) - )) + .wrap(RedisSession::new("127.0.0.1:6379", &[0; 32])) + // enable logger + .wrap(Logger::default()) // register simple route, handle all methods - .service(web::resource("/").to(index)) + .service(resource("/").route(get().to(index))) ) - .bind("0.0.0.0:8080")? - .start() + .bind("127.0.0.1:8080")? + .run() .await } ```