Added config file for db #9

Merged
phoenix merged 32 commits from db into devel 2025-04-03 13:59:56 +00:00
3 changed files with 19 additions and 0 deletions
Showing only changes of commit e17a304896 - Show all commits

View File

@@ -1,4 +1,21 @@
use axum::{Json, http::StatusCode};
use serde::{Deserialize, Serialize};
#[derive(Deserialize, Serialize)]
pub struct TestResult {
message: String,
}
// basic handler that responds with a static string
pub async fn root() -> &'static str {
"Hello, World!"
}
pub async fn db_ping() -> (StatusCode, Json<TestResult>) {
let tr = TestResult {
message: String::from("Should work"),
};
(StatusCode::OK, Json(tr))
}

View File

@@ -4,4 +4,5 @@ pub mod register;
pub mod endpoints {
pub const ROOT: &str = "/";
pub const REGISTER: &str = "/api/v2/register";
pub const DBTEST: &str = "/api/v2/test/db";
}

View File

@@ -19,6 +19,7 @@ async fn main() {
// build our application with a route
let app = Router::new()
.layer(axum::Extension(pool))
.route(callers::endpoints::DBTEST, get(callers::common::db_ping))
.route(callers::endpoints::ROOT, get(callers::common::root))
.route(
callers::endpoints::REGISTER,