summaryrefslogtreecommitdiffstats
path: root/src/api.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/api.rs')
-rw-r--r--src/api.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/api.rs b/src/api.rs
index f74e33a..17cbd03 100644
--- a/src/api.rs
+++ b/src/api.rs
@@ -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())?;