mirror of
https://github.com/actix/actix-extras.git
synced 2025-02-24 19:23:19 +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.
|
> Identity service for actix-web framework.
|
||||||
|
|
||||||
[](https://crates.io/crates/actix-cors)
|
[](https://crates.io/crates/actix-identity)
|
||||||
[](https://docs.rs/actix-cors/0.4.0-beta.1)
|
[](https://docs.rs/actix-identity/0.4.0-beta.1)
|
||||||

|

|
||||||
[](https://deps.rs/crate/actix-cors/0.4.0-beta.1)
|
[](https://deps.rs/crate/actix-identity/0.4.0-beta.1)
|
||||||
|
|
||||||
## Documentation & community resources
|
## Documentation & community resources
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
## Documentation & Resources
|
## 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)
|
- [Example Project](https://github.com/actix/examples/tree/HEAD/session/redis-session)
|
||||||
- Minimum Supported Rust Version (MSRV): 1.46
|
- 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.
|
Constructor panics if key length is less than 32 bytes.
|
||||||
|
|
||||||
```rust
|
```rust
|
||||||
use actix_web::{App, HttpServer, web, middleware};
|
use actix_web::{App, HttpServer, middleware::Logger};
|
||||||
use actix_web::middleware::session::SessionStorage;
|
use actix_web::web::{resource, get}
|
||||||
use actix_redis::RedisSession;
|
use actix_redis::RedisSession;
|
||||||
|
|
||||||
#[actix_rt::main]
|
#[actix_web::main]
|
||||||
async fn main() -> std::io::Result {
|
async fn main() -> std::io::Result<()> {
|
||||||
HttpServer::new(|| App::new()
|
HttpServer::new(move || App::new()
|
||||||
// enable logger
|
|
||||||
.middleware(middleware::Logger::default())
|
|
||||||
// cookie session middleware
|
// cookie session middleware
|
||||||
.middleware(SessionStorage::new(
|
.wrap(RedisSession::new("127.0.0.1:6379", &[0; 32]))
|
||||||
RedisSession::new("127.0.0.1:6379", &[0; 32])
|
// enable logger
|
||||||
))
|
.wrap(Logger::default())
|
||||||
// register simple route, handle all methods
|
// register simple route, handle all methods
|
||||||
.service(web::resource("/").to(index))
|
.service(resource("/").route(get().to(index)))
|
||||||
)
|
)
|
||||||
.bind("0.0.0.0:8080")?
|
.bind("127.0.0.1:8080")?
|
||||||
.start()
|
.run()
|
||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
Loading…
x
Reference in New Issue
Block a user