Health-Check API
File: kinetic-node/src/api.rs
Crate: kinetic-node | Stage: 12
What Is This?
A minimal two-route Axum router at port 16003. No auth, no JSON bodies, no state. Just enough for infrastructure monitoring tools to check if the node is alive and what its Peer ID is.
The daemon has a large API with ~15 routes. The node has 2. This reflects its role: infrastructure nodes should be black boxes — no management interface, just “is it up and what is it?”
Routes
GET /health → "OK"
A plain-text liveness check. Returns HTTP 200 with body OK. Used by load balancers, uptime monitors, and the service manager to check if the node process is responsive.
-> See: kinetic-node/src/api.rs — Line 12
GET /peer_id → <PeerId as String>
Returns the node’s static libp2p Peer ID as a base58-encoded string (starts with 12D3Koo). Used by operators to verify which node they’re talking to and to extract the Peer ID for adding to bootstrap node lists.
-> See: kinetic-node/src/api.rs — Lines 13–16
The local_peer_id is captured into the closure via move, making the handler stateless — no Arc, no lock, no runtime lookup.
Tests
Uses tower::ServiceExt::oneshot() to drive the Axum router without binding a real socket:
test_health_endpoint— 200 +"OK".test_peer_id_endpoint— 200 + correct Peer ID string.test_health_endpoint_post_method_rejected— POST to/health→ 405.test_peer_id_endpoint_put_method_rejected— PUT to/peer_id→ 405.test_unknown_route_returns_404—/does_not_exist→ 404.test_health_endpoint_ignores_query_params—/health?foo=bar→ 200.
-> See: kinetic-node/src/api.rs — Lines 19–152