Skip to content

module

key_proxy

A route in front of an API that needs a key, so a component's src can reach it without the key going anywhere near the browser.

pub fn configure(cfg: &mut ServiceConfig) {
    KeyProxy::new("https://api.census.gov/data", Key::Query("key", "CENSUS_KEY"))
        .route(cfg, "/api/census");
}
// then: BarChart(src: "/api/census/2021/acs/acs5?get=NAME,B01001_001E&for=state:*")

Structs

  • KeyProxy

    Forwards GETs under one upstream URL, adding the key.

Enums

  • Key

    How the upstream API takes its key. Each names the environment variable holding it.