Expand description
Where the app’s gateways are reached.
url is a gateway’s URL in the environment the code runs in, as to
hand a client outside the app the address of its API:
ⓘ
use encore::gateways;
let callback = format!("{}/webhooks/stripe", gateways::url("api"));A service calls the app’s other services with crate::services, not
through a gateway.
Looking a gateway’s URL up links the calling service to it. Encore reads the link from the code, as it reads which services a service depends on: so the name must be a string literal, written as the gateway declares it, the function must be called directly rather than passed around, and the call must be in a service.
Functions§
- url
- The URL
gatewayis reached at in this environment, without a trailing slash: a path goes after it,{url}/webhooks/stripe. It is the first of the gateway’s origins, ascrate::env::app_metalists them.