MCPcopy Create free account
hub / github.com/actix/examples / main

Function main

https-tls/rustls/src/main.rs:23–42  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

21
22#[actix_web::main]
23async fn main() -> std::io::Result<()> {
24 env_logger::init_from_env(env_logger::Env::default().default_filter_or("info"));
25
26 let config = load_rustls_config();
27
28 log::info!("starting HTTPS server at https://localhost:8443");
29
30 HttpServer::new(|| {
31 App::new()
32 // enable logger
33 .wrap(middleware::Logger::default())
34 // register simple handler, handle all methods
35 .service(web::resource("/index.html").to(index))
36 .service(web::redirect("/", "/index.html"))
37 .service(Files::new("/static", "static"))
38 })
39 .bind_rustls_0_23("127.0.0.1:8443", config)?
40 .run()
41 .await
42}
43
44fn load_rustls_config() -> rustls::ServerConfig {
45 rustls::crypto::aws_lc_rs::default_provider()

Callers

nothing calls this directly

Calls 2

runMethod · 0.80
load_rustls_configFunction · 0.70

Tested by

no test coverage detected