mirror of
https://github.com/actix/actix-extras.git
synced 2025-02-22 10:23:18 +01:00
Minor README fixes (#174)
This commit is contained in:
parent
727353213f
commit
8741cd32cc
@ -2,10 +2,10 @@
|
||||
|
||||
> Identity service for actix-web framework.
|
||||
|
||||
[](https://crates.io/crates/actix-cors)
|
||||
[](https://docs.rs/actix-cors/0.4.0-beta.1)
|
||||

|
||||
[](https://deps.rs/crate/actix-cors/0.4.0-beta.1)
|
||||
[](https://crates.io/crates/actix-identity)
|
||||
[](https://docs.rs/actix-identity/0.4.0-beta.1)
|
||||

|
||||
[](https://deps.rs/crate/actix-identity/0.4.0-beta.1)
|
||||
|
||||
## Documentation & community resources
|
||||
|
||||
|
@ -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
|
||||
}
|
||||
```
|
||||
|
Loading…
x
Reference in New Issue
Block a user