add health route
This commit is contained in:
parent
573261911d
commit
d4ea5b55b9
|
@ -443,6 +443,7 @@ dependencies = [
|
|||
"log",
|
||||
"magick_rust",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"tokio",
|
||||
]
|
||||
|
||||
|
|
|
@ -14,4 +14,5 @@ env_logger = "0.10.0"
|
|||
log = "0.4.17"
|
||||
magick_rust = "0.17.0"
|
||||
serde = { version = "1.0.159", features = ["derive"] }
|
||||
serde_json = "1.0.95"
|
||||
tokio = {version = "1", features = ["macros", "rt-multi-thread"]}
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
use axum::{extract::DefaultBodyLimit, routing::post, Router};
|
||||
use axum::{extract::DefaultBodyLimit, routing::get, routing::post, Router};
|
||||
|
||||
use crate::routes::liquid::liquid_rescale_route;
|
||||
use crate::routes::{health::health_route, liquid::liquid_rescale_route};
|
||||
|
||||
pub fn create_router() -> Router {
|
||||
Router::new()
|
||||
.route("/health", get(health_route))
|
||||
.route("/liquid", post(liquid_rescale_route))
|
||||
.layer(DefaultBodyLimit::max(1024 * 10_000 /* 10 MiB */))
|
||||
}
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
use axum::{response::IntoResponse, Json};
|
||||
use serde_json::json;
|
||||
|
||||
pub async fn health_route() -> impl IntoResponse {
|
||||
Json(json!({
|
||||
"ready": true,
|
||||
"reason": "Everything is OK"
|
||||
}))
|
||||
}
|
|
@ -1 +1,2 @@
|
|||
pub mod health;
|
||||
pub mod liquid;
|
||||
|
|
Loading…
Reference in New Issue