v0.01
This commit is contained in:
@@ -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::<Books>().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::<Books>().await.expect("Unable to return value");
|
||||
|
||||
return Json(resjson);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user