Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/server.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use crate::prelude::*;

use crate::{lib_context::LibContext, service};
use axum::response::Json;
use axum::{Router, routing};
use tower::ServiceBuilder;
use tower_http::{
Expand Down Expand Up @@ -37,6 +38,7 @@ pub async fn init_server(
.allow_headers([axum::http::header::CONTENT_TYPE]);
}
let app = Router::new()
.route("/healthz", routing::get(healthz))
.route(
"/cocoindex",
routing::get(|| async { "CocoIndex is running!" }),
Expand Down Expand Up @@ -92,3 +94,10 @@ pub async fn init_server(
let serve_fut = async { axum::serve(listener, app).await.unwrap() };
Ok(serve_fut.boxed())
}

async fn healthz() -> Json<serde_json::Value> {
Json(serde_json::json!({
"status": "ok",
"version": env!("CARGO_PKG_VERSION"),
}))
}
Loading