MCPcopy Create free account
hub / github.com/BcnRust/devbcn-workshop / films_endpoint

Function films_endpoint

front/src/main.rs:13–20  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

11const API_ENDPOINT: &str = "api/v1";
12
13fn films_endpoint() -> String {
14 let window = web_sys::window().expect("no global `window` exists");
15 let location = window.location();
16 let host = location.host().expect("should have a host");
17 let protocol = location.protocol().expect("should have a protocol");
18 let endpoint = format!("{}//{}/{}", protocol, host, API_ENDPOINT);
19 format!("{}/films", endpoint)
20}
21
22async fn get_films() -> Vec<Film> {
23 log::info!("Getting films {}", films_endpoint());

Callers 2

get_filmsFunction · 0.85
AppFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected