- Introduction
- Features
- Prerequisites
- Installation
- Environment Configuration
- Running the Application
- Generating Documentation
- API Documentation
- Endpoints
- Technologies Used
This API is designed to help manage users, categories, and news articles. It includes features like secure login, user roles, and tools to create, read, update, and delete (CRUD) categories and news articles.
- 🔒 Secure login and authentication
- 📂 CRUD operations for categories and news articles
- 🛡️ Admin-only access to certain features
- 📝 Well-organized route structure
Make sure you have the following installed before you start:
- Rust and Cargo
git clone <repository_url>
cd actix-web-apicargo buildCreate a .env file in the project root and add the following settings:
# Database Configuration
DATABASE_URL=your_database_connection_string
# Authentication
JWT_SECRET=your_jwt_secret_key
cargo runcargo build --release
./target/release/actix-web-apiRust has a built-in way to create documentation from comments in the code.
- Run this command to generate the documentation:
This will create and open the documentation in your web browser.
cargo doc --open
- Make sure to add proper Rust documentation comments (
///for items,//!for module-level comments).
POST /auth/register- Register a new userPOST /auth/login- Log in a user
POST /admin/create-news- Add a news articlePUT /admin/news-update/{id}- Edit a news articleGET /admin/list-news- Show all news articlesPOST /admin/create-category- Add a new categoryPUT /admin/update-category- Edit a categoryGET /admin/news-detail/{id}- Get details of a specific news articleDELETE /admin/delete-news/{id}- Remove a news articleDELETE /admin/delete-category/{id}- Remove a category
GET /user/list-news- Show all news articles
- 🚀 Web Framework: Actix Web
- 🛢️ Database: PostgreSQL
- 🔑 Authentication: JWT-based security
- 📦 Dependency Management: Cargo
- 📝 API Testing: Postman or
curl
Feel free to submit issues and pull requests to improve this API.