Axum hello world

This commit is contained in:
Drew 2025-08-22 18:45:37 -07:00
parent daa8ea00ba
commit 1e02b39199
4 changed files with 772 additions and 3 deletions

View file

@ -1,3 +1,20 @@
fn main() {
println!("Hello, world!");
use axum::{Router, routing::get};
#[tokio::main]
async fn main() {
tracing_subscriber::fmt::init();
let app = Router::new().route("/health", get(health));
let addr = "127.0.0.1:3000";
let listener = tokio::net::TcpListener::bind(addr).await.unwrap();
tracing::info!("API Server listening on {}", listener.local_addr().unwrap());
axum::serve(listener, app).await.unwrap();
}
async fn health() -> &'static str {
"Ok"
}