1
0
mirror of https://github.com/actix/examples synced 2024-11-23 22:41:07 +01:00

changed order of logging middleware, which must register last

This commit is contained in:
dowwie 2019-06-01 09:24:54 -04:00
parent 6c7b068a90
commit 4e3a42d77d
3 changed files with 5 additions and 5 deletions

View File

@ -82,10 +82,10 @@ fn main() -> io::Result<()> {
HttpServer::new(|| { HttpServer::new(|| {
App::new() App::new()
// enable logger
.wrap(middleware::Logger::default())
// cookie session middleware // cookie session middleware
.wrap(CookieSession::signed(&[0; 32]).secure(false)) .wrap(CookieSession::signed(&[0; 32]).secure(false))
// enable logger
.wrap(middleware::Logger::default())
// register favicon // register favicon
.service(favicon) .service(favicon)
// register simple route, handle all methods // register simple route, handle all methods

View File

@ -22,12 +22,12 @@ fn main() -> std::io::Result<()> {
HttpServer::new(|| { HttpServer::new(|| {
App::new() App::new()
.wrap(middleware::Logger::default())
.wrap(IdentityService::new( .wrap(IdentityService::new(
CookieIdentityPolicy::new(&[0; 32]) CookieIdentityPolicy::new(&[0; 32])
.name("auth-example") .name("auth-example")
.secure(false), .secure(false),
)) ))
.wrap(middleware::Logger::default())
.service(web::resource("/login").route(web::post().to(login))) .service(web::resource("/login").route(web::post().to(login)))
.service(web::resource("/logout").to(logout)) .service(web::resource("/logout").to(logout))
.service(web::resource("/").route(web::get().to(index))) .service(web::resource("/").route(web::get().to(index)))

View File

@ -26,10 +26,10 @@ fn main() -> std::io::Result<()> {
HttpServer::new(|| { HttpServer::new(|| {
App::new() App::new()
// enable logger
.wrap(middleware::Logger::default())
// redis session middleware // redis session middleware
.wrap(RedisSession::new("127.0.0.1:6379", &[0; 32])) .wrap(RedisSession::new("127.0.0.1:6379", &[0; 32]))
// enable logger
.wrap(middleware::Logger::default())
// register simple route, handle all methods // register simple route, handle all methods
.service(web::resource("/").to(index)) .service(web::resource("/").to(index))
}) })