Proxy routes (spec/01 §1.8): media a component needs from another origin, fetched by the host's one same-origin proxy, so a page holds same-origin URLs only.
iex> route = %{name: "tiles", url: "https://tiles.example/{z}/{x}/{y}.png", types: ["image/png"]}
iex> Macaw.Component.Proxy.path("geo.map", route, %{"z" => "1", "x" => "0", "y" => "0"})
{:ok, "/macaw/proxy/geo.map/tiles?x=0&y=0&z=1"}
Summary
Functions
The same-origin path a render uses for a route of a component:
/macaw/proxy/<component>/<route>?<values>, the values query-encoded in name order.
Every placeholder needs a value: {:error, {:placeholders, missing}} otherwise.
The placeholders a route's URL template names, in order of first appearance.
Types
Functions
@spec path(String.t(), route(), %{required(String.t()) => String.t()}) :: {:ok, String.t()} | {:error, {:placeholders, [String.t(), ...]}}
The same-origin path a render uses for a route of a component:
/macaw/proxy/<component>/<route>?<values>, the values query-encoded in name order.
Every placeholder needs a value: {:error, {:placeholders, missing}} otherwise.
The placeholders a route's URL template names, in order of first appearance.