summaryrefslogtreecommitdiffstats
path: root/src/routes/users.rs
blob: eb08ade757f999d0fc2b5a47ee9dee30fe198fd0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
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> = state.db.users().read_all().await?;
    Ok(HttpResponse::Ok().body(render!(templates::users_html, users).unwrap()))
}