1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
//! # axum_responses
//!
//! Ergonomic response builders for Axum web applications.
//!
//! This crate provides three main response types that implement `IntoResponse`:
//!
//! - [`JsonResponse`] - Standardized JSON API responses
//! - [`File`] - File downloads and inline content
//! - [`Redirect`] - HTTP redirects
//!
//! ## Quick Start
//!
//! ```rust
//! use axum_responses::JsonResponse;
//! use serde_json::json;
//!
//! // Simple OK response
//! async fn health() -> JsonResponse {
//! JsonResponse::Ok().message("Healthy")
//! }
//!
//! // Response with data
//! async fn get_user() -> JsonResponse {
//! JsonResponse::Ok().data(json!({"id": 1, "name": "Alice"}))
//! }
//!
//! // Error response
//! async fn not_found() -> JsonResponse {
//! JsonResponse::NotFound().message("User not found")
//! }
//! ```
//!
//! ## Final JSON Format
//!
//! All JSON responses follow this standardized structure:
//!
//! ```json
//! {
//! "code": 200,
//! "success": true,
//! "message": "Healthy",
//! "timestamp": "2023-10-01T12:00:00Z"
//! "data": { ... }, // Optional (present using .data())
//! "error": { ... } // Optional (present using .error())
//! "errors": [ ... ] // Optional (present using .errors())
//! }
//! ```
pub use HttpError;
pub use ;