use std::io::Cursor; use std::str::FromStr; use tiny_http::{Header, Response}; use crate::repo::recipe::StaticRecipeRepo; use crate::rest::types::Url; pub fn fetch_list(url: &Url) -> Response>> { use crate::domain::recipe::fetch_list; let repo = StaticRecipeRepo; // TODO: catch notfound error let recipe = fetch_list::execute(&repo); let data = serde_json::to_string(&recipe).unwrap(); Response::from_string(data) .with_header(Header::from_str("content-type: application/json").unwrap()) }