Basic health endpoint.
This commit is contained in:
17
src/main.rs
17
src/main.rs
@@ -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"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user