An easy-to-host PDS on the ATProtocol, iPhone and MacOS. Maintain control of your keys and data, always.
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

feat(relay): XRPC _health endpoint (MM-73 #16

open opened by malpercio.dev targeting main from malpercio/mm-73-xrpc-_health-endpoint

Summary#

  • Implements GET /xrpc/_health — the first real XRPC route and the pattern for all future endpoint additions
  • Returns {"version":"0.1.0","db":"ok"} (200) when the SQLite pool is healthy; {"version":"0.1.0","db":"error"} (503) when it isn't
  • Establishes routes/ module with one file per endpoint (routes/health.rs)

Changes#

  • routes/health.rs — handler (impl IntoResponse), 4 integration tests covering 200/503/content-type/version
  • routes/mod.rs — module entry point
  • app.rs — register /xrpc/_health before catch-all; promote test_state() to pub(crate) for reuse across endpoint test modules; drop dead_code suppression on AppState.db
  • main.rs — declare mod routes
  • Cargo.toml — add serde dep for #[derive(Serialize)] on the response struct

Test plan#

  • cargo test -p relay — all 21 tests pass (4 new: health_returns_200_with_db_ok, health_db_error_returns_503_with_db_error, health_response_has_json_content_type, health_version_is_cargo_pkg_version)
  • cargo clippy --workspace -- -D warnings — clean
  • Manual: cargo run -- --config relay.toml then curl http://localhost:8080/xrpc/_health returns {"version":"0.1.0","db":"ok"}

Closes MM-73

Labels

None yet.

assignee

None yet.

Participants 1
AT URI
at://did:web:malpercio.dev/sh.tangled.repo.pull/3mgs7ixmlfl22
Diff #0

No differences found between the selected revisions.

History

1 round 0 comments
sign up or login to add to the discussion
malpercio.dev submitted #0
patch application failed: error: No valid patches in input (allow with "--allow-empty")
expand 0 comments