diff --git a/backend/src/main.rs b/backend/src/main.rs index b0f6080..13ffa88 100644 --- a/backend/src/main.rs +++ b/backend/src/main.rs @@ -1,11 +1,17 @@ -use axum::{response::IntoResponse, routing::get, Router}; +use axum::{response::IntoResponse, routing::get, Json, Router}; use axum_extra::routing::SpaRouter; use clap::Parser; +use serde::{Deserialize, Serialize}; use std::net::{IpAddr, Ipv6Addr, SocketAddr}; use std::str::FromStr; use tower::ServiceBuilder; use tower_http::trace::TraceLayer; +#[derive(Deserialize, Serialize, Debug)] +struct Books { + numFound: u32, +} + // Setup the command line interface with clap. #[derive(Parser, Debug)] #[clap(name = "server", about = "A server for our wasm project!")] @@ -57,5 +63,8 @@ async fn main() { } 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 resjson = res.json::().await; + return Json(resjson); }