Skip to main content

Module http

Module http 

Source
Expand description

HTTP/JSON gateway, health checks and Prometheus metrics.

The router is created once and serves for the whole process lifetime: while standing by (or shutting down) the API answers 503 with a JSON error, /healthz stays 200 and /readyz reports 503. Requests are authenticated before their body is read.

Task ids are JSON strings (they exceed the integer precision of JavaScript numbers).

Structs§

ApiError
An error response: {"error": "...", "code": "..."}.
ApiJson
JSON body extractor whose rejections are JSON errors.
ConnInfo
Per-connection facts made available to handlers.
TaskJson
A task in JSON form.

Functions§

metrics_router
Router for the optional unauthenticated metrics listener (/metrics, /healthz, /readyz).
router
The full HTTP router (health, API, metrics).
serve
Serve router on listener (optionally over TLS) until stop is cancelled, then drain connections for up to drain.
status_name
Lower-case name of a wire status.