diff options
Diffstat (limited to 'src/api.rs')
-rw-r--r-- | src/api.rs | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -2,14 +2,13 @@ use axum::{response::IntoResponse, routing::get}; use crate::state::AppState; -mod users; pub mod error; +mod users; -pub fn router(state: AppState) -> axum::Router { +pub fn router() -> axum::Router<AppState> { axum::Router::new() .merge(users::router()) .route("/healthcheck", get(healthcheck)) - .with_state(state) } pub async fn healthcheck() -> impl IntoResponse { @@ -25,6 +24,7 @@ mod tests { use axum::{ body::Body, http::{Request, StatusCode}, + Router, }; use sqlx::PgPool; use tower::ServiceExt; @@ -33,7 +33,7 @@ mod tests { async fn test_healthcheck_ok(pool: PgPool) -> TestResult { setup_test_env(); - let router = router(AppState { pool }); + let router = Router::new().merge(router()).with_state(AppState { pool }); let request = Request::builder().uri("/healthcheck").body(Body::empty())?; |