Skip to main content

Crate phrona_api

Crate phrona_api 

Source

Modules§

frontend
Serves the static web frontend.
grounding
metrics
Prometheus metrics for the REST API.
tavily
tools

Structs§

AppError
AppState
HeaderAuth
Header-only auth for GET endpoints. Query-string api_key parameters are rejected with a 400: credentials in URLs leak through logs, proxies and referrers and are a classic SSRF/credential-theft vector.
JsonBody
JSON body extractor whose rejection (missing body, malformed JSON, wrong content type) is a JSON 400 instead of axum’s defaults. Bodies larger than the configured server.max_body_bytes are rejected with a 413 before deserialization.
JsonQuery
Query-string extractor whose rejection is a JSON 400 instead of axum’s default plain-text response.

Functions§

default_addr
Default bind address when none is configured.
router
Build the axum router from a PhronaConfig: the search client (profile / timeout / proxies / concurrency), the API key, the max_results clamp, the rate limit and the body-size cap all come from the config.
serve
Serve the REST API on addr. Blocks until the server stops (Ctrl+C or SIGTERM trigger a graceful shutdown that drains in-flight requests).
shutdown_signal
Wait for Ctrl+C or SIGTERM, then return so the server can drain in-flight requests gracefully.