v0.01
This commit is contained in:
@@ -9,7 +9,7 @@ use tower_http::trace::TraceLayer;
|
|||||||
|
|
||||||
#[derive(Deserialize, Serialize, Debug)]
|
#[derive(Deserialize, Serialize, Debug)]
|
||||||
struct Books {
|
struct Books {
|
||||||
numFound: u32,
|
num_found: u32,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Setup the command line interface with clap.
|
// Setup the command line interface with clap.
|
||||||
@@ -64,7 +64,10 @@ async fn main() {
|
|||||||
|
|
||||||
async fn hello() -> impl IntoResponse {
|
async fn hello() -> impl IntoResponse {
|
||||||
//"hello from server!"
|
//"hello from server!"
|
||||||
let res = reqwest::get("https://openlibrary.org/search.json?q=the+lord+of+the+rings").await?;
|
let res = reqwest::get("https://openlibrary.org/search.json?q=the+lord+of+the+rings")
|
||||||
let resjson = res.json::<Books>().await;
|
.await
|
||||||
|
.expect("Unable to request");
|
||||||
|
let resjson = res.json::<Books>().await.expect("Unable to return value");
|
||||||
|
|
||||||
return Json(resjson);
|
return Json(resjson);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user