mirror of
https://github.com/tokio-rs/axum.git
synced 2026-08-22 00:00:17 +02:00
Fix compile time regression by boxing routes internally (#404)
This is a reimplementation of #401 but with the new matchit based router. Fixes #399
This commit is contained in:
@@ -4,26 +4,31 @@
|
||||
//! cargo run -p example-tls-rustls
|
||||
//! ```
|
||||
|
||||
use axum::{handler::get, Router};
|
||||
// NOTE: This example is currently broken since axum-server requires `S: Sync`,
|
||||
// that isn't necessary and will be fixed in a future release
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() {
|
||||
// Set the RUST_LOG, if it hasn't been explicitly defined
|
||||
if std::env::var_os("RUST_LOG").is_none() {
|
||||
std::env::set_var("RUST_LOG", "example_tls_rustls=debug")
|
||||
}
|
||||
tracing_subscriber::fmt::init();
|
||||
fn main() {}
|
||||
|
||||
let app = Router::new().route("/", get(handler));
|
||||
// use axum::{handler::get, Router};
|
||||
|
||||
axum_server::bind_rustls("127.0.0.1:3000")
|
||||
.private_key_file("examples/tls-rustls/self_signed_certs/key.pem")
|
||||
.certificate_file("examples/tls-rustls/self_signed_certs/cert.pem")
|
||||
.serve(app)
|
||||
.await
|
||||
.unwrap();
|
||||
}
|
||||
// #[tokio::main]
|
||||
// async fn main() {
|
||||
// // Set the RUST_LOG, if it hasn't been explicitly defined
|
||||
// if std::env::var_os("RUST_LOG").is_none() {
|
||||
// std::env::set_var("RUST_LOG", "example_tls_rustls=debug")
|
||||
// }
|
||||
// tracing_subscriber::fmt::init();
|
||||
|
||||
async fn handler() -> &'static str {
|
||||
"Hello, World!"
|
||||
}
|
||||
// // let app = Router::new().route("/", get(handler));
|
||||
|
||||
// // axum_server::bind_rustls("127.0.0.1:3000")
|
||||
// // .private_key_file("examples/tls-rustls/self_signed_certs/key.pem")
|
||||
// // .certificate_file("examples/tls-rustls/self_signed_certs/cert.pem")
|
||||
// // .serve(app)
|
||||
// // .await
|
||||
// // .unwrap();
|
||||
// }
|
||||
|
||||
// async fn handler() -> &'static str {
|
||||
// "Hello, World!"
|
||||
// }
|
||||
|
||||
Reference in New Issue
Block a user