Skip to main content

Module frontends

Module frontends 

Source
Expand description

Where the app’s frontends are reached.

url is a frontend’s URL in the environment the code runs in, as to send a user there or to build a link to one of its pages:

ⓘ
use encore::frontends;

let reset = format!("{}/reset?token={token}", frontends::url("web"));

Looking a frontend’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 frontend declares it, the function must be called directly rather than passed around, and the call must be in a service.

Functions§

url
The URL frontend is reached at in this environment, without a trailing slash: a path goes after it, {url}/reset. It is the first of the frontend’s origins, as crate::env::app_meta lists them.