Skip to main content

Module frontends

Module frontends 

Source
Expand description

Resolving URLs for the application’s frontends.

Call url to get a frontend’s base URL in the current environment, for example to redirect users or construct links to frontend pages:

ⓘ
use encore::frontends;

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

Looking up a frontend URL records a dependency from the calling service to that frontend. Because Encore parses this dependency statically, pass the frontend’s declared name as a string literal, call frontends::url directly (rather than through a function pointer), and make the call inside a service.

Functions§

url
Returns the base URL for frontend in the current environment, without a trailing slash (so paths can be appended directly, e.g. {url}/reset).