feat(server): tracing and http2
parent
5a5ab7ad52
commit
b6179147f3
|
@ -6,12 +6,13 @@ edition = "2021"
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
axum = "0.6.18"
|
axum = { version = "0.6.18", features = ["http2"] }
|
||||||
futures = "0.3.28"
|
futures = "0.3.28"
|
||||||
libarchive = { path = "../libarchive" }
|
libarchive = { path = "../libarchive" }
|
||||||
sha256 = "1.1.4"
|
sha256 = "1.1.4"
|
||||||
tokio = { version = "1.29.1", features = ["full"] }
|
tokio = { version = "1.29.1", features = ["full"] }
|
||||||
tokio-util = { version = "0.7.8", features = ["io"] }
|
tokio-util = { version = "0.7.8", features = ["io"] }
|
||||||
tower = { version = "0.4.13", features = ["make"] }
|
tower = { version = "0.4.13", features = ["make"] }
|
||||||
tower-http = { version = "0.4.1", features = ["fs"] }
|
tower-http = { version = "0.4.1", features = ["fs", "trace"] }
|
||||||
|
tracing-subscriber = "0.3.17"
|
||||||
uuid = { version = "1.4.0", features = ["v4"] }
|
uuid = { version = "1.4.0", features = ["v4"] }
|
||||||
|
|
|
@ -8,6 +8,7 @@ use axum::Router;
|
||||||
use repo::RepoGroupManager;
|
use repo::RepoGroupManager;
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
use std::sync::{Arc, RwLock};
|
use std::sync::{Arc, RwLock};
|
||||||
|
use tower_http::trace::TraceLayer;
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub struct Config {
|
pub struct Config {
|
||||||
|
@ -42,10 +43,13 @@ async fn main() {
|
||||||
repo_manager: Arc::new(RwLock::new(repo_manager)),
|
repo_manager: Arc::new(RwLock::new(repo_manager)),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
tracing_subscriber::fmt::init();
|
||||||
|
|
||||||
// build our application with a single route
|
// build our application with a single route
|
||||||
let app = Router::new()
|
let app = Router::new()
|
||||||
.merge(repo::router(&global))
|
.merge(repo::router(&global))
|
||||||
.with_state(global);
|
.with_state(global)
|
||||||
|
.layer(TraceLayer::new_for_http());
|
||||||
|
|
||||||
// run it with hyper on localhost:3000
|
// run it with hyper on localhost:3000
|
||||||
axum::Server::bind(&"0.0.0.0:3000".parse().unwrap())
|
axum::Server::bind(&"0.0.0.0:3000".parse().unwrap())
|
||||||
|
|
Loading…
Reference in New Issue