aboutsummaryrefslogtreecommitdiff
path: root/src/handlers/planets.rs
diff options
context:
space:
mode:
authorCara Salter <cara@devcara.com>2022-06-08 14:14:24 -0400
committerCara Salter <cara@devcara.com>2022-06-08 14:14:46 -0400
commit6a777564a4319a3809a9e2872a3eaf1cc39b8b01 (patch)
tree1020d58993cfef64abc6b4b17ccefe9bd5ec4bf6 /src/handlers/planets.rs
parent64db5de9920c2668488693df02baaed41ee1340d (diff)
downloadsolard-6a777564a4319a3809a9e2872a3eaf1cc39b8b01.tar.gz
solard-6a777564a4319a3809a9e2872a3eaf1cc39b8b01.zip
meta: Complete project rename
Diffstat (limited to 'src/handlers/planets.rs')
-rw-r--r--src/handlers/planets.rs18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/handlers/planets.rs b/src/handlers/planets.rs
new file mode 100644
index 0000000..e80e7fe
--- /dev/null
+++ b/src/handlers/planets.rs
@@ -0,0 +1,18 @@
+use axum::{response::IntoResponse, Json};
+
+use tracing::{error, instrument};
+
+use solarlib::star::Star;
+use solarlib::planet::Planet;
+
+use crate::errors::*;
+
+pub async fn list() -> JsonResult<Json<Vec<Planet>>> {
+ let con_url = std::env::var("QEMU_URL").unwrap_or("qemu:///system".to_string());
+ let mut star = Star::new(con_url)?;
+
+ let inhabitants = star.inhabitants()?;
+
+ Ok(Json(inhabitants))
+}
+