-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.rs
38 lines (33 loc) · 930 Bytes
/
main.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
use axum::handler::get;
use axum::Router;
#[tokio::main]
async fn main() {
start().await;
}
async fn start() {
let inner = Router::new()
.route("/a", get(get_a))
.route("/a", get(get_a))
.route("/a", get(get_a))
.route("/a", get(get_a))
.route("/a", get(get_a))
.route("/a", get(get_a))
.route("/a", get(get_a))
.route("/a", get(get_a))
.route("/a", get(get_a))
.route("/a", get(get_a))
.route("/a", get(get_a))
.route("/a", get(get_a));
// Remove boxed, and the `cargo check` goes from multiple minutes to around a second.
// .boxed();
let app = Router::new()
.route("/a", get(get_a))
.nest("/b", inner);
axum::Server::bind(&"0.0.0.0:3000".parse().unwrap())
.serve(app.into_make_service())
.await
.unwrap();
}
async fn get_a() -> &'static str {
"ok"
}