healthcheck implemented
This commit is contained in:
parent
3b42995e47
commit
514fa9d48f
3 changed files with 30 additions and 2 deletions
28
src/main.rs
28
src/main.rs
|
@ -1,9 +1,17 @@
|
|||
use axum::{routing::get, Router};
|
||||
use axum::{http::StatusCode, routing::get, routing::post, routing::put, Json, Router};
|
||||
|
||||
use serde_json::{json, Value};
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() {
|
||||
// build our application with a single route
|
||||
let app = Router::new().route("/", get(|| async { "Hello, World!" }));
|
||||
let app = Router::new()
|
||||
.route("/", get(root))
|
||||
.route("/users/create", post(create_user))
|
||||
.route("/users/auth", get(auth_user))
|
||||
.route("/syncs/progress", put(update_progress))
|
||||
.route("/syncs/progress/:document", put(get_progress))
|
||||
.route("/healthcheck", get(healthcheck));
|
||||
|
||||
// run it with hyper on localhost:3000
|
||||
axum::Server::bind(&"0.0.0.0:3000".parse().unwrap())
|
||||
|
@ -11,3 +19,19 @@ async fn main() {
|
|||
.await
|
||||
.unwrap();
|
||||
}
|
||||
|
||||
async fn root() -> &'static str {
|
||||
"Hello, world!"
|
||||
}
|
||||
|
||||
async fn create_user() {}
|
||||
|
||||
async fn auth_user() {}
|
||||
|
||||
async fn update_progress() {}
|
||||
|
||||
async fn get_progress() {}
|
||||
|
||||
async fn healthcheck() -> (StatusCode, Json<Value>) {
|
||||
(StatusCode::OK, Json(json!({ "state": "OK" })))
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue