mirror of
https://github.com/fafhrd91/actix-web
synced 2024-12-02 19:32:24 +01:00
update guide example
This commit is contained in:
parent
50b2f62c80
commit
d0c01c2cdd
@ -115,7 +115,7 @@ session data.
|
|||||||
# extern crate actix;
|
# extern crate actix;
|
||||||
# extern crate actix_web;
|
# extern crate actix_web;
|
||||||
use actix_web::*;
|
use actix_web::*;
|
||||||
use actix_web::middlewares::RequestSession;
|
use actix_web::middlewares::{RequestSession, SessionStorage, CookieSessionBackend};
|
||||||
|
|
||||||
fn index(mut req: HttpRequest) -> Result<&'static str> {
|
fn index(mut req: HttpRequest) -> Result<&'static str> {
|
||||||
// access session data
|
// access session data
|
||||||
@ -133,8 +133,8 @@ fn main() {
|
|||||||
# let sys = actix::System::new("basic-example");
|
# let sys = actix::System::new("basic-example");
|
||||||
HttpServer::new(
|
HttpServer::new(
|
||||||
|| Application::new()
|
|| Application::new()
|
||||||
.middleware(middlewares::SessionStorage::new( // <- create session middlewares
|
.middleware(SessionStorage::new( // <- create session middlewares
|
||||||
middlewares::CookieSessionBackend::build(&[0; 32]) // <- create cookie session backend
|
CookieSessionBackend::build(&[0; 32]) // <- create cookie session backend
|
||||||
.secure(false)
|
.secure(false)
|
||||||
.finish()
|
.finish()
|
||||||
)))
|
)))
|
||||||
|
Loading…
Reference in New Issue
Block a user