mirror of
https://github.com/flibusta-apps/batch_downloader.git
synced 2026-03-03 07:00:48 +01:00
Add health check endpoint
This commit is contained in:
@@ -99,6 +99,10 @@ async fn download(Path(task_id): Path<String>) -> impl IntoResponse {
|
|||||||
Body::from_stream(stream).into_response()
|
Body::from_stream(stream).into_response()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async fn health_check() -> impl IntoResponse {
|
||||||
|
StatusCode::OK
|
||||||
|
}
|
||||||
|
|
||||||
pub async fn get_router() -> Router {
|
pub async fn get_router() -> Router {
|
||||||
let (prometheus_layer, metric_handle) = PrometheusMetricLayer::pair();
|
let (prometheus_layer, metric_handle) = PrometheusMetricLayer::pair();
|
||||||
|
|
||||||
@@ -114,7 +118,9 @@ pub async fn get_router() -> Router {
|
|||||||
let metric_router =
|
let metric_router =
|
||||||
Router::new().route("/metrics", get(|| async move { metric_handle.render() }));
|
Router::new().route("/metrics", get(|| async move { metric_handle.render() }));
|
||||||
|
|
||||||
let public_router = Router::new().route("/api/download/{task_id}", get(download));
|
let public_router = Router::new()
|
||||||
|
.route("/api/download/{task_id}", get(download))
|
||||||
|
.route("/health", get(health_check));
|
||||||
|
|
||||||
Router::new()
|
Router::new()
|
||||||
.merge(public_router)
|
.merge(public_router)
|
||||||
|
|||||||
Reference in New Issue
Block a user