chore: scaffold axum server with in-memory CRUD, auth stub and tracing
This commit is contained in:
25
backend/src/web/routes_health.rs
Normal file
25
backend/src/web/routes_health.rs
Normal file
@@ -0,0 +1,25 @@
|
||||
use axum::{Router, routing::get};
|
||||
|
||||
pub fn routes_health() -> Router {
|
||||
Router::new().route("/health", get(health))
|
||||
}
|
||||
|
||||
async fn health() -> &'static str {
|
||||
"up"
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use axum::{Router, routing::get};
|
||||
use axum_test::TestServer;
|
||||
|
||||
use crate::web::routes_health::health;
|
||||
|
||||
#[tokio::test]
|
||||
async fn test_route_health() {
|
||||
let app = Router::new().route(&"/health", get(health));
|
||||
let server = TestServer::new(app);
|
||||
let response = server.get("/health").await;
|
||||
response.assert_status_ok().assert_text("up");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user