use std::collections::HashMap; pub fn get_route_data(route: &str) -> String { let route_data: String; match route { "/fetch" => { route_data = fetch_asset(); } &_ => todo!(), } route_data } pub fn route_exists(route: &str) -> bool { let existing_routes = get_routes(); if existing_routes.contains_key(route) { true } else { false } } fn get_routes() -> HashMap { let mut routes = HashMap::new(); routes.insert("/fetch".to_string(), "fetch_asset".to_string()); routes } fn fetch_asset() -> String { let asset = r#"{ "title": "this is a title", "id": 2, "url": "https://www.espn.com }"#; asset.to_string() }