mirror of
https://github.com/actix/actix-extras.git
synced 2024-11-28 01:32:57 +01:00
update redis example
This commit is contained in:
parent
88f66d49d0
commit
ca76dff5a7
@ -7,5 +7,5 @@ workspace = "../.."
|
|||||||
[dependencies]
|
[dependencies]
|
||||||
env_logger = "0.5"
|
env_logger = "0.5"
|
||||||
actix = "0.5"
|
actix = "0.5"
|
||||||
actix-web = "0.4"
|
actix-web = "0.5"
|
||||||
actix-redis = { version = "0.2", features = ["web"] }
|
actix-redis = { version = "0.3", features = ["web"] }
|
||||||
|
@ -5,8 +5,8 @@ extern crate actix_web;
|
|||||||
extern crate actix_redis;
|
extern crate actix_redis;
|
||||||
extern crate env_logger;
|
extern crate env_logger;
|
||||||
|
|
||||||
use actix_web::*;
|
use actix_web::{server, App, HttpRequest, HttpResponse, Result};
|
||||||
use actix_web::middleware::RequestSession;
|
use actix_web::middleware::{Logger, SessionStorage, RequestSession};
|
||||||
use actix_redis::RedisSessionBackend;
|
use actix_redis::RedisSessionBackend;
|
||||||
|
|
||||||
|
|
||||||
@ -30,12 +30,12 @@ fn main() {
|
|||||||
env_logger::init();
|
env_logger::init();
|
||||||
let sys = actix::System::new("basic-example");
|
let sys = actix::System::new("basic-example");
|
||||||
|
|
||||||
HttpServer::new(
|
server::new(
|
||||||
|| Application::new()
|
|| App::new()
|
||||||
// enable logger
|
// enable logger
|
||||||
.middleware(middleware::Logger::default())
|
.middleware(Logger::default())
|
||||||
// cookie session middleware
|
// cookie session middleware
|
||||||
.middleware(middleware::SessionStorage::new(
|
.middleware(SessionStorage::new(
|
||||||
RedisSessionBackend::new("127.0.0.1:6379", &[0; 32])
|
RedisSessionBackend::new("127.0.0.1:6379", &[0; 32])
|
||||||
))
|
))
|
||||||
// register simple route, handle all methods
|
// register simple route, handle all methods
|
||||||
|
Loading…
Reference in New Issue
Block a user