diff options
author | cel 🌸 <cel@blos.sm> | 2023-12-12 14:14:30 +0000 |
---|---|---|
committer | cel 🌸 <cel@blos.sm> | 2023-12-12 14:14:30 +0000 |
commit | 370a25e5a0cbb95e2aa1cec55305b22aeaf99aa0 (patch) | |
tree | 665163bc58c8e94320b843b1983376d9a67f99bf /src/routes/users.rs | |
parent | 5dc4774ed3380762b4d7aadc86193af6073c456a (diff) | |
download | pinussy-370a25e5a0cbb95e2aa1cec55305b22aeaf99aa0.tar.gz pinussy-370a25e5a0cbb95e2aa1cec55305b22aeaf99aa0.tar.bz2 pinussy-370a25e5a0cbb95e2aa1cec55305b22aeaf99aa0.zip |
initial refactor
Diffstat (limited to '')
-rw-r--r-- | src/routes/users.rs | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/routes/users.rs b/src/routes/users.rs new file mode 100644 index 0000000..2ad9ede --- /dev/null +++ b/src/routes/users.rs @@ -0,0 +1,16 @@ +use actix_web::{get, web, HttpResponse}; + +use crate::templates; +use crate::users::User; +use crate::{Pinussy, Result}; + +#[get("/users")] +async fn get(state: web::Data<Pinussy>) -> Result<HttpResponse> { + let users: Vec<User> = sqlx::query_as("select * from users") + .fetch_all(&state.db) + .await + // TODO: no unwrap + .unwrap(); + println!("lol"); + Ok(HttpResponse::Ok().body(render!(templates::users_html, users).unwrap())) +} |