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,6 +1,6 @@
[package]
name = "rustls-example"
version = "0.1.0"
version = "1.0.0"
authors = ["Nikolay Kim <fafhrd91@gmail.com>"]
workspace = ".."
edition = "2018"
@ -11,6 +11,7 @@ path = "src/main.rs"
[dependencies]
env_logger = "0.5"
rustls = "0.15"
actix-web = { version = "1.0.0", features=["rust-tls"] }
actix-files = "0.1.0"
rustls = "0.16"
actix-web = { version = "2.0.0-alpha.3", features=["rustls"] }
actix-files = "0.2.0-alpha.3"
actix-rt = "1.0.0-alpha.3"

View File

@ -2,19 +2,20 @@ use std::fs::File;
use std::io::BufReader;
use actix_files::Files;
use actix_web::{middleware, web, App, Error, HttpRequest, HttpResponse, HttpServer};
use actix_web::{middleware, web, App, HttpRequest, HttpResponse, HttpServer};
use rustls::internal::pemfile::{certs, rsa_private_keys};
use rustls::{NoClientAuth, ServerConfig};
/// simple handle
fn index(req: HttpRequest) -> Result<HttpResponse, Error> {
async fn index(req: HttpRequest) -> HttpResponse {
println!("{:?}", req);
Ok(HttpResponse::Ok()
HttpResponse::Ok()
.content_type("text/plain")
.body("Welcome!"))
.body("Welcome!")
}
fn main() -> std::io::Result<()> {
#[actix_rt::main]
async fn main() -> std::io::Result<()> {
if std::env::var("RUST_LOG").is_err() {
std::env::set_var("RUST_LOG", "actix_web=info");
}
@ -43,5 +44,6 @@ fn main() -> std::io::Result<()> {
.service(Files::new("/static", "static"))
})
.bind_rustls("127.0.0.1:8443", config)?
.run()
.start()
.await
}