Expand description
Reaching the app’s other services.
ⓘ
let users = encore::services::base_url("users");
let resp = client.get(format!("{users}/users/{id}")).send().await?;Looking up a service’s URL makes the calling service depend on it. Encore reads the dependency from the code, as it reads which resources a service uses: so the name must be a string literal, the function must be called directly rather than passed around, and the call must be in a service.
Functions§
- base_
url - The base URL the calling service reaches
serviceat, for service-to-service calls, without a trailing slash: a call’s path goes after it,{base}/users/42.