summaryrefslogtreecommitdiffstats
path: root/src/routes/healthcheck.rs
blob: e0c44705e40b259ec2e965a360f32431f9752b72 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
use axum::{response::IntoResponse, Json};
use axum_extra::routing::TypedPath;
use serde::Deserialize;

#[derive(Debug, Deserialize, TypedPath)]
#[typed_path("/api/healthcheck")]
pub struct HealthCheck;

impl HealthCheck {
    #[tracing::instrument]
    pub async fn get(self) -> impl IntoResponse {
        const MESSAGE: &str = "Unnamed server";

        let json_response = serde_json::json!({
            "status": "success",
            "message": MESSAGE
        });

        Json(json_response)
    }
}