aboutsummaryrefslogtreecommitdiffstats
path: root/web/template/src
diff options
context:
space:
mode:
authormsi2025-11-13 14:10:43 -0300
committermsi2025-11-13 14:10:43 -0300
commit3e51ca5cea08d8f20e579cdac7aa296f96967439 (patch)
tree5d6d7a2930c4460b922a072f08d85cdd40f8fdf8 /web/template/src
parent017324a1e98ac2da7812e4fcc06fe67d424e4ffb (diff)
downloadtemplates-3e51ca5cea08d8f20e579cdac7aa296f96967439.tar.gz
Add healthz router
Diffstat (limited to 'web/template/src')
-rw-r--r--web/template/src/router.rs11
1 files changed, 10 insertions, 1 deletions
diff --git a/web/template/src/router.rs b/web/template/src/router.rs
index d1c8ba2..64ec718 100644
--- a/web/template/src/router.rs
+++ b/web/template/src/router.rs
@@ -16,7 +16,11 @@
use std::{sync::Arc, time::Duration};
use axum::{
- Router, extract::State, http::StatusCode, response::Html, routing::get,
+ Router,
+ extract::State,
+ http::StatusCode,
+ response::{Html, IntoResponse},
+ routing::get,
};
use minijinja::context;
use tower_http::{
@@ -27,6 +31,7 @@ use crate::state::AppState;
pub(crate) fn route(app_state: Arc<AppState>) -> Router {
Router::new()
+ .route("/healthz", get(healthz))
.route("/", get(handler_home))
.route("/content", get(handler_content))
.route("/about", get(handler_about))
@@ -40,6 +45,10 @@ pub(crate) fn route(app_state: Arc<AppState>) -> Router {
.with_state(app_state)
}
+async fn healthz() -> impl IntoResponse {
+ StatusCode::OK
+}
+
async fn handler_home(
State(state): State<Arc<AppState>>,
) -> Result<Html<String>, StatusCode> {