1
0
mirror of https://github.com/actix/actix-extras.git synced 2024-12-18 01:33:59 +01:00

fix example

This commit is contained in:
Nikolay Kim 2019-12-16 00:04:47 +06:00
parent 25a2546933
commit 616e42dedc

View File

@ -3,7 +3,7 @@ use actix_session::Session;
use actix_web::{middleware, web, App, Error, HttpRequest, HttpServer, Responder}; use actix_web::{middleware, web, App, Error, HttpRequest, HttpServer, Responder};
/// simple handler /// simple handler
fn index(req: HttpRequest, session: Session) -> Result<impl Responder, Error> { async fn index(req: HttpRequest, session: Session) -> Result<impl Responder, Error> {
println!("{:?}", req); println!("{:?}", req);
// session // session
@ -17,7 +17,8 @@ fn index(req: HttpRequest, session: Session) -> Result<impl Responder, Error> {
Ok("Welcome!") Ok("Welcome!")
} }
fn main() -> std::io::Result<()> { #[actix_rt::main]
async fn main() -> std::io::Result<()> {
std::env::set_var("RUST_LOG", "actix_web=info,actix_redis=info"); std::env::set_var("RUST_LOG", "actix_web=info,actix_redis=info");
env_logger::init(); env_logger::init();
@ -31,5 +32,6 @@ fn main() -> std::io::Result<()> {
.service(web::resource("/").to(index)) .service(web::resource("/").to(index))
}) })
.bind("0.0.0.0:8080")? .bind("0.0.0.0:8080")?
.run() .start()
.await
} }