Basic health endpoint.

This commit is contained in:
Tom Alexander
2024-07-14 15:14:52 -04:00
parent ecce4f04c9
commit 02e288ef31
5 changed files with 812 additions and 3 deletions

View File

@@ -1,3 +1,16 @@
fn main() {
println!("Hello, world!");
use axum::routing::get;
use axum::Router;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let app = Router::new().route("/health", get(health));
let listener = tokio::net::TcpListener::bind("0.0.0.0:8080").await?;
println!("Listening on port 8080. Pop open your browser to http://127.0.0.1:8080/ .");
axum::serve(listener, app).await?;
Ok(())
}
async fn health() -> &'static str {
"ok"
}