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:
parent
2b4e360adc
commit
d9ca7cb055
@ -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
7
cookie-session/README.md
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
## Cookie session example
|
||||||
|
|
||||||
|
```sh
|
||||||
|
cd cookie-session
|
||||||
|
cargo run
|
||||||
|
# Starting http server: 127.0.0.1:8080
|
||||||
|
```
|
@ -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()
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user