use std::net::SocketAddr; use axum::{routing::get, Router}; use tracing_subscriber::{layer::SubscriberExt, util::SubscriberInitExt}; use witch_watch::{db, handlers}; #[tokio::main] async fn main() { tracing_subscriber::registry() .with( tracing_subscriber::EnvFilter::try_from_default_env() .unwrap_or_else(|_| "witch_watch=debug,axum::routing=info".into()), ) .with(tracing_subscriber::fmt::layer()) .init(); let pool = db::get_pool().await; // build our application with some routes use handlers::*; let app = Router::new() .route( "/", get(using_connection_pool_extractor).post(using_connection_extractor), ) .with_state(pool); tracing::debug!("binding to 0.0.0.0:3000"); axum::Server::bind(&SocketAddr::from(([0, 0, 0, 0], 3000))) .serve(app.into_make_service()) .await .unwrap(); }