This project is a Blog Content Management System (CMS) API built with Rust. It features role-based permissions and provides endpoints for managing users, posts, and roles. The API is built using the Axum framework and integrates with a SQL database.
- User Management: Create, read, update, and delete users.
- Post Management: Create, read, update, and delete posts.
- Role Management: Manage user roles and permissions.
- Health Check: Endpoint to check the health of the API.
src/routes/mod.rs
: Defines the main API routes.src/models/post.rs
: Contains data models for posts.src/routes/user.rs
: Defines routes related to user management.src/routes/role.rs
: Defines routes related to role management.src/routes/health.rs
: Defines the health check route.src/services
: Contains service definitions and implementations.
POST /api/user/
: Create a new user.GET /api/user/
: Get a list of users.GET /api/user/:id
: Get a user by ID.PUT /api/user/:id
: Update a user by ID.DELETE /api/user/:id
: Delete a user by ID.GET /api/user/:id/posts
: Get posts by a user ID.
POST /api/post/
: Create a new post.GET /api/post/
: Get a list of posts.GET /api/post/:id
: Get a post by ID.PUT /api/post/:id
: Update a post by ID.DELETE /api/post/:id
: Delete a post by ID.
POST /api/role/
: Create a new role.GET /api/role/
: Get a list of roles.GET /api/role/:id
: Get a role by ID.PUT /api/role/:id
: Update a role by ID.DELETE /api/role/:id
: Delete a role by ID.
GET /api/health/
: Check the health of the API.
-
Clone the repository:
git clone <repository-url> cd <repository-directory>
-
Install dependencies:
cargo build
-
Run the application:
cargo run
- Rust: Programming language.
- Axum: Web framework.
- Serde: Serialization and deserialization.
- Chrono: Date and time handling.
- UUID: Universally unique identifier.
Contributions are welcome! Please open an issue or submit a pull request.
This project is licensed under the MIT License.