Generation

generate functionSat, 12 Nov 2022

get request from api to get all items

fn get_all_items() -> Result<Vec<Item>> { let url = "http://localhost:8080/items"; let res = reqwest::get(url)?.text()?; let items = serde_json::from_str(&res)?; Ok(items) } let items = get_all_items().unwrap();

Questions about programming?Chat with your personal AI assistant