Moved router code to its own function
Some checks failed
Rust Build / Check (pull_request) Successful in 53s
Rust Build / Test Suite (pull_request) Failing after 58s
Rust Build / Rustfmt (pull_request) Successful in 28s
Rust Build / Clippy (pull_request) Successful in 57s
Rust Build / build (pull_request) Successful in 1m21s

This commit is contained in:
KD
2025-04-03 12:25:01 -04:00
parent 68a9998572
commit 79f6ebdc09

View File

@@ -21,11 +21,7 @@ async fn main() {
axum::serve(listener, app).await.unwrap();
}
async fn app() -> Router {
let pool = icarus_auth::db_pool::create_pool()
.await
.expect("Failed to create pool");
async fn routes() -> Router {
// build our application with a route
Router::new()
.route(callers::endpoints::DBTEST, get(callers::common::db_ping))
@@ -34,7 +30,14 @@ async fn app() -> Router {
callers::endpoints::REGISTER,
post(callers::register::register_user),
)
.layer(axum::Extension(pool))
}
async fn app() -> Router {
let pool = icarus_auth::db_pool::create_pool()
.await
.expect("Failed to create pool");
routes().await.layer(axum::Extension(pool))
}
#[cfg(test)]