1
0
mirror of https://github.com/actix/examples synced 2025-06-28 18:00:37 +02:00

upgrade to 2.0 alpha.3

This commit is contained in:
Nikolay Kim
2019-12-07 23:59:24 +06:00
parent e7f7175b7b
commit 3127352797
100 changed files with 1075 additions and 1107 deletions

View File

@ -1,15 +1,15 @@
[package]
name = "cookie-session"
version = "0.1.0"
version = "1.0.0"
authors = ["Nikolay Kim <fafhrd91@gmail.com>"]
workspace = ".."
edition = "2018"
[dependencies]
actix-web = "1.0.0"
actix-session = "0.2.0"
actix-rt = "0.2.5"
actix-web = "2.0.0-alpha.3"
actix-session = "0.3.0-alpha.3"
actix-rt = "1.0.0-alpha.3"
futures = "0.1"
futures = "0.3.1"
time = "0.1"
env_logger = "0.6"

View File

@ -9,7 +9,7 @@ use actix_session::{CookieSession, Session};
use actix_web::{middleware::Logger, web, App, HttpRequest, HttpServer, Result};
/// simple index handler with session
fn index(session: Session, req: HttpRequest) -> Result<&'static str> {
async fn index(session: Session, req: HttpRequest) -> Result<&'static str> {
println!("{:?}", req);
// RequestSession trait is used for session access
@ -25,10 +25,11 @@ fn index(session: Session, req: HttpRequest) -> Result<&'static str> {
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");
env_logger::init();
let sys = actix_rt::System::new("cookie-session");
println!("Starting http server: 127.0.0.1:8080");
HttpServer::new(|| {
App::new()
@ -39,8 +40,6 @@ fn main() -> std::io::Result<()> {
.service(web::resource("/").to(index))
})
.bind("127.0.0.1:8080")?
.start();
println!("Starting http server: 127.0.0.1:8080");
sys.run()
.start()
.await
}