aboutsummaryrefslogtreecommitdiff
path: root/src/handlers
diff options
context:
space:
mode:
Diffstat (limited to 'src/handlers')
-rw-r--r--src/handlers/mod.rs2
-rw-r--r--src/handlers/waifus.rs18
2 files changed, 19 insertions, 1 deletions
diff --git a/src/handlers/mod.rs b/src/handlers/mod.rs
index 097d8a6..addf742 100644
--- a/src/handlers/mod.rs
+++ b/src/handlers/mod.rs
@@ -1 +1 @@
-pub waifus;
+pub mod waifus;
diff --git a/src/handlers/waifus.rs b/src/handlers/waifus.rs
new file mode 100644
index 0000000..117ba15
--- /dev/null
+++ b/src/handlers/waifus.rs
@@ -0,0 +1,18 @@
+use axum::{response::IntoResponse, Json};
+
+use tracing::{error, instrument};
+
+use waifulib::house::House;
+use waifulib::waifu::Waifu;
+
+use crate::errors::*;
+
+pub async fn list() -> JsonResult<Json<Vec<Waifu>>> {
+ let con_url = std::env::var("QEMU_URL").unwrap_or("qemu:///system".to_string());
+ let mut house: House = House::new(con_url)?;
+
+ let inhabitants = house.inhabitants()?;
+
+ Ok(Json(inhabitants))
+}
+