configure_http/
configure_http.rs1use axum::{routing::get, Router};
6use hyper_server::HttpConfig;
7use std::net::SocketAddr;
8
9#[tokio::main]
10async fn main() {
11 let app = Router::new().route("/", get(|| async { "Hello, world!" }));
12
13 let config = HttpConfig::new()
14 .http1_only(true)
15 .http2_only(false)
16 .max_buf_size(8192)
17 .build();
18
19 let addr = SocketAddr::from(([127, 0, 0, 1], 3000));
20 println!("listening on {}", addr);
21 hyper_server::bind(addr)
22 .http_config(config)
23 .serve(app.into_make_service())
24 .await
25 .unwrap();
26}