mirror of
https://seed.radicle.dev/rad:z4V1sjrXqjvFdnCUbxPFqd5p4DtH5.git
synced 2026-10-18 19:30:27 +08:00
746 B
746 B
radicle-httpd
Rust backend for radicle-explorer.
Code conventions
- Each route module exposes
pub fn router(ctx: Context) -> Router; handlers are privateasync fns - Handler signature:
async fn handler(State(ctx): State<Context>, Path(rid): Path<RepoId>) -> impl IntoResponse - Annotate the error type on Ok:
Ok::<_, Error>(Json(data)) - All response structs:
#[serde(rename_all = "camelCase")] - Optional fields:
#[serde(skip_serializing_if = "Option::is_none")] - Use
json!()macro for inline JSON;immutable_response()/cached_response()helpers for Cache-Control headers - Module structure:
api/v1/handlers,api/json/serialization helpers,api/query.rsquery param types,api/error.rserror types