A response builder for Axum.
This package includes several Axum response builders and different extractors based on the JSON response structure specified in JSON Data Error Response (JDER). With the builders and extractors provided, various kinds of responses can be created easily instead of sending plain text responses.
To install this package, run the following command:
cargo add jder_axum
Create a JSON response for an Axum route:
use jder_axum::response::{
Response,
json::CreateJsonResponse,
};
async fn route() -> Response {
CreateJsonResponse::dataless().send()
}
And the response will be shown as below:
{
"success": true,
"data": null,
"error": null
}
This project is licensed under the terms of the MIT license.