1
0
mirror of https://github.com/actix/actix-extras.git synced 2024-11-27 17:22:57 +01:00

Minor README fixes (#174)

This commit is contained in:
Lunush 2021-04-09 16:39:50 +03:00 committed by GitHub
parent 727353213f
commit 8741cd32cc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 18 deletions

View File

@ -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

View File

@ -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
}
```