mirror of
https://github.com/actix/actix-extras.git
synced 2024-11-24 07:53:00 +01:00
fix example
This commit is contained in:
parent
9e610a8134
commit
93707884d2
@ -8,11 +8,11 @@ extern crate env_logger;
|
||||
extern crate futures;
|
||||
|
||||
use actix_redis::RedisSessionBackend;
|
||||
use actix_web::middleware::RequestSession;
|
||||
use actix_web::middleware::session::{self, RequestSession};
|
||||
use actix_web::{middleware, server, App, HttpRequest, HttpResponse, Result};
|
||||
|
||||
/// simple handler
|
||||
fn index(mut req: HttpRequest) -> Result<HttpResponse> {
|
||||
fn index(req: HttpRequest) -> Result<HttpResponse> {
|
||||
println!("{:?}", req);
|
||||
|
||||
// session
|
||||
@ -36,14 +36,14 @@ fn main() {
|
||||
// enable logger
|
||||
.middleware(middleware::Logger::default())
|
||||
// cookie session middleware
|
||||
.middleware(middleware::SessionStorage::new(
|
||||
.middleware(session::SessionStorage::new(
|
||||
RedisSessionBackend::new("127.0.0.1:6379", &[0; 32])
|
||||
))
|
||||
// register simple route, handle all methods
|
||||
.resource("/", |r| r.f(index))
|
||||
}).bind("0.0.0.0:8080")
|
||||
.unwrap()
|
||||
.threads(1)
|
||||
.workers(1)
|
||||
.start();
|
||||
|
||||
let _ = sys.run();
|
||||
|
Loading…
Reference in New Issue
Block a user