summaryrefslogtreecommitdiff
path: root/server/src/routes
diff options
context:
space:
mode:
Diffstat (limited to 'server/src/routes')
-rw-r--r--server/src/routes/mod.rs1
-rw-r--r--server/src/routes/user.rs13
2 files changed, 14 insertions, 0 deletions
diff --git a/server/src/routes/mod.rs b/server/src/routes/mod.rs
new file mode 100644
index 0000000..22d12a3
--- /dev/null
+++ b/server/src/routes/mod.rs
@@ -0,0 +1 @@
+pub mod user;
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))
+}