https://github.com/jder-std/axum
A response builder for Axum
https://github.com/jder-std/axum
axum builder extractor json response rust
Last synced: 11 months ago
JSON representation
A response builder for Axum
- Host: GitHub
- URL: https://github.com/jder-std/axum
- Owner: alpheustangs
- License: mit
- Created: 2024-10-04T18:53:39.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-11-08T00:56:52.000Z (over 1 year ago)
- Last Synced: 2024-11-08T01:46:03.369Z (over 1 year ago)
- Topics: axum, builder, extractor, json, response, rust
- Language: Rust
- Homepage: https://docs.rs/jder_axum
- Size: 158 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# JDER axum
A response builder for axum.
This package includes different axum response builders, extractors and layers based on the JSON response structure specified in [JSON Data Error Response (JDER)](https://github.com/jder-std/spec). With the builders and extractors provided, various kinds of responses can be created easily instead of sending plain text responses.
## Installation
To install this package, run the following command:
```bash
cargo add jder_axum
```
## Quick Start
Create a JSON response for an axum route:
```rust
use jder_axum::response::{
Response,
json::CreateJsonResponse,
};
async fn route() -> Response {
CreateJsonResponse::dataless().send()
}
```
And the response will be shown as below:
```json
{
"success": true,
"data": null,
"error": null
}
```
## Compatibility
A compatibility list of `axum` and `jder_axum`:
| `axum` Version | `jder_axum` Version |
| -------------- | ------------------- |
| ~0.8.3 | 0.5.0+ |
| ~0.8.1 | 0.4.0 |
| ~0.7.9 | 0.3.1 |
| ~0.7.7 | 0.1.0 - 0.3.0 |
## License
This project is licensed under the terms of the MIT license.