splitted health on dedicated mod

This commit is contained in:
Dmitri 2026-04-16 09:44:52 +02:00
parent 7ee03f4d52
commit 921a22e645
Signed by: kanopo
GPG Key ID: 759ADD40E3132AC7
3 changed files with 14 additions and 4 deletions

1
src/http/mod.rs Normal file
View File

@ -0,0 +1 @@
pub mod public;

9
src/http/public.rs Normal file
View File

@ -0,0 +1,9 @@
use axum::{Router, routing::get};
pub fn router() -> Router {
Router::new().route("/health", get(get_health()))
}
fn get_health() -> &'static str {
"{'status': 'ok'}"
}

View File

@ -1,10 +1,10 @@
use axum::{Router, routing::get};
mod http;
use axum::Router;
#[tokio::main]
async fn main() {
let app = Router::new()
.route("/", get(|| async { "hello world" }))
.route("/health", get(|| async { "ok" }));
let app = Router::new().merge(http::public::router());
let listener = tokio::net::TcpListener::bind("0.0.0.0:8080").await.unwrap();
axum::serve(listener, app).await.unwrap();