1
0
mirror of https://github.com/actix/examples synced 2025-02-02 09:39:03 +01:00

Make cookie-session example clarify (#175)

This commit is contained in:
Yuki Okushi 2019-09-14 19:37:39 +09:00 committed by GitHub
parent 2b4e360adc
commit d9ca7cb055
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 1 deletions

View File

@ -8,6 +8,7 @@ edition = "2018"
[dependencies] [dependencies]
actix-web = "1.0.0" actix-web = "1.0.0"
actix-session = "0.2.0" actix-session = "0.2.0"
actix-rt = "0.2.5"
futures = "0.1" futures = "0.1"
time = "0.1" time = "0.1"

7
cookie-session/README.md Normal file
View File

@ -0,0 +1,7 @@
## Cookie session example
```sh
cd cookie-session
cargo run
# Starting http server: 127.0.0.1:8080
```

View File

@ -28,6 +28,7 @@ fn index(session: Session, req: HttpRequest) -> Result<&'static str> {
fn main() -> std::io::Result<()> { fn main() -> std::io::Result<()> {
std::env::set_var("RUST_LOG", "actix_web=info"); std::env::set_var("RUST_LOG", "actix_web=info");
env_logger::init(); env_logger::init();
let sys = actix_rt::System::new("cookie-session");
HttpServer::new(|| { HttpServer::new(|| {
App::new() App::new()
@ -38,5 +39,8 @@ fn main() -> std::io::Result<()> {
.service(web::resource("/").to(index)) .service(web::resource("/").to(index))
}) })
.bind("127.0.0.1:8080")? .bind("127.0.0.1:8080")?
.run() .start();
println!("Starting http server: 127.0.0.1:8080");
sys.run()
} }