diff options
Diffstat (limited to 'server/src/routes/user.rs')
-rw-r--r-- | server/src/routes/user.rs | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/server/src/routes/user.rs b/server/src/routes/user.rs new file mode 100644 index 0000000..f155f27 --- /dev/null +++ b/server/src/routes/user.rs @@ -0,0 +1,13 @@ +use crate::errors::AppError; +use crate::models::user::User; +use axum::{routing::get, Json, Router}; + +pub fn create_route() -> Router { + Router::new().route("/", get(list_users)) +} + +async fn list_users() -> Result<Json<Vec<User>>, AppError> { + let users = User::list().await?; + + Ok(Json(users)) +} |