Closed kwaa closed 5 months ago
This update introduces a new API module to the Rust workspace, integrates it with existing backend and OpenAPI documentation, and enhances the Dockerfile with a health check mechanism. The new API module includes a route to generate a 204 response, which is essential for the health check. Dependencies are updated accordingly across the backend and OpenAPI crates.
Files / Grouped Files | Change Summary |
---|---|
Cargo.toml |
Added crates/api workspace member and dependency declaration for hatsu_api . |
Dockerfile |
Updated to include a health check using curl and dynamic port exposure. |
crates/api/Cargo.toml |
Introduced hatsu_api workspace configuration with dependencies like axum , url , and utoipa . |
crates/api/src/lib.rs |
Added modules entities and routes , re-exported routes . |
crates/api/src/routes/generate_204.rs |
Introduced a public async function generate_204 to handle GET requests and return a 204 status code. |
crates/api/src/routes/mod.rs |
Defined routing for the new 204 response endpoint. |
crates/backend/Cargo.toml |
Added hatsu_api dependency. |
crates/backend/src/routes.rs |
Integrated hatsu_api::routes() into the existing routes. |
crates/openapi/Cargo.toml |
Added hatsu_api dependency. |
crates/openapi/src/apidoc.rs |
Added generate_204 path from hatsu_api::routes to OpenAPI documentation. |
sequenceDiagram
participant Client
participant DockerContainer
participant HatsuAPI
participant Backend
participant OpenAPI
Client->>DockerContainer: Start Container
DockerContainer->>HatsuAPI: Health Check (GET /api/v0/generate_204)
HatsuAPI->>Backend: Validate Request
Backend->>HatsuAPI: 204 No Content
HatsuAPI->>DockerContainer: 204 No Content
DockerContainer->>Client: Container is Healthy
Client->>Backend: API Request
Backend->>HatsuAPI: Route Request
HatsuAPI->>Backend: Process Request
Backend->>Client: Response
In code and Docker, we trust, New routes and health checks, a must. With
curl
and 204, we see, Our app stands strong, healthy and free. 🎉🐇🚀
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
Summary by CodeRabbit
New Features
Improvements
Configuration