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.
- Conn
Info - Per-connection facts made available to handlers.
- Task
Json - 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
routeronlistener(optionally over TLS) untilstopis cancelled, then drain connections for up todrain. - status_
name - Lower-case name of a wire status.