From 370a25e5a0cbb95e2aa1cec55305b22aeaf99aa0 Mon Sep 17 00:00:00 2001 From: cel 🌸 Date: Tue, 12 Dec 2023 14:14:30 +0000 Subject: initial refactor --- src/routes/users.rs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 src/routes/users.rs (limited to 'src/routes/users.rs') 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) -> Result { + let users: Vec = 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())) +} -- cgit