From 543ae918f79ea524ddc0e014aec2cf0e1511bcf7 Mon Sep 17 00:00:00 2001 From: Vinod J M Date: Sun, 2 Oct 2022 10:38:14 +0530 Subject: [PATCH] v0.01 --- backend/src/main.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/backend/src/main.rs b/backend/src/main.rs index 13ffa88..f829c96 100644 --- a/backend/src/main.rs +++ b/backend/src/main.rs @@ -9,7 +9,7 @@ use tower_http::trace::TraceLayer; #[derive(Deserialize, Serialize, Debug)] struct Books { - numFound: u32, + num_found: u32, } // Setup the command line interface with clap. @@ -64,7 +64,10 @@ async fn main() { async fn hello() -> impl IntoResponse { //"hello from server!" - let res = reqwest::get("https://openlibrary.org/search.json?q=the+lord+of+the+rings").await?; - let resjson = res.json::().await; + let res = reqwest::get("https://openlibrary.org/search.json?q=the+lord+of+the+rings") + .await + .expect("Unable to request"); + let resjson = res.json::().await.expect("Unable to return value"); + return Json(resjson); }