Add /up endpoint for uptime monitoring

This commit is contained in:
Aadi Desai 2023-10-25 00:29:27 +01:00
parent 125dca39b9
commit 1fc926a989
Signed by: supleed2
SSH key fingerprint: SHA256:CkbNRs0yVzXEiUp2zd0PSxsfRUMFF9bLlKXtE1xEbKM
2 changed files with 18 additions and 11 deletions

View file

@ -115,7 +115,9 @@ async fn poise(
tracing::info!("Secrets loaded"); tracing::info!("Secrets loaded");
// Build Axum Router // Build Axum Router
let router = axum::Router::new().route( let router = axum::Router::new()
.route("/up", axum::routing::get(routes::up))
.route(
"/verify", "/verify",
axum::routing::post({ axum::routing::post({
let pool = pool.clone(); let pool = pool.clone();

View file

@ -1,7 +1,12 @@
use crate::PendingMember; use crate::PendingMember;
use axum::{http::StatusCode, response::IntoResponse, Json}; use axum::{http::StatusCode, response::IntoResponse, Json};
#[derive(serde::Deserialize, serde::Serialize)] #[tracing::instrument]
pub(crate) async fn up() -> impl IntoResponse {
(StatusCode::OK, "Nano is up!")
}
#[derive(serde::Deserialize)]
pub(crate) struct Verify { pub(crate) struct Verify {
id: String, id: String,
shortcode: String, shortcode: String,