File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change 11use crate :: prelude:: * ;
22
33use crate :: { lib_context:: LibContext , service} ;
4+ use axum:: response:: Json ;
45use axum:: { Router , routing} ;
56use tower:: ServiceBuilder ;
67use tower_http:: {
@@ -37,6 +38,7 @@ pub async fn init_server(
3738 . allow_headers ( [ axum:: http:: header:: CONTENT_TYPE ] ) ;
3839 }
3940 let app = Router :: new ( )
41+ . route ( "/healthz" , routing:: get ( healthz) )
4042 . route (
4143 "/cocoindex" ,
4244 routing:: get ( || async { "CocoIndex is running!" } ) ,
@@ -92,3 +94,10 @@ pub async fn init_server(
9294 let serve_fut = async { axum:: serve ( listener, app) . await . unwrap ( ) } ;
9395 Ok ( serve_fut. boxed ( ) )
9496}
97+
98+ async fn healthz ( ) -> Json < serde_json:: Value > {
99+ Json ( serde_json:: json!( {
100+ "status" : "ok" ,
101+ "version" : env!( "CARGO_PKG_VERSION" ) ,
102+ } ) )
103+ }
You can’t perform that action at this time.
0 commit comments