feat(server): tracing and http2

This commit is contained in:
Jef Roosens 2023-07-15 20:07:19 +02:00
parent 5a5ab7ad52
commit b6179147f3
Signed by: Jef Roosens
GPG key ID: B75D4F293C7052DB
2 changed files with 8 additions and 3 deletions

View file

@ -8,6 +8,7 @@ use axum::Router;
use repo::RepoGroupManager;
use std::path::PathBuf;
use std::sync::{Arc, RwLock};
use tower_http::trace::TraceLayer;
#[derive(Clone)]
pub struct Config {
@ -42,10 +43,13 @@ async fn main() {
repo_manager: Arc::new(RwLock::new(repo_manager)),
};
tracing_subscriber::fmt::init();
// build our application with a single route
let app = Router::new()
.merge(repo::router(&global))
.with_state(global);
.with_state(global)
.layer(TraceLayer::new_for_http());
// run it with hyper on localhost:3000
axum::Server::bind(&"0.0.0.0:3000".parse().unwrap())