Updating README.md File
نجحت جميع الفحوصات
CI - Fruit API / build-and-test (push) Successful in 41s

هذا الالتزام موجود في:
ahmedgamalyousef
2025-10-04 22:47:10 +03:00
الأصل f95728213f
التزام ff3510a961

عرض الملف

@@ -2,9 +2,9 @@
# 🍎 Fruit Store API # 🍎 Fruit Store API
A simple **RESTful API** built with Flask that manages fruits in a store. A simple **RESTful API** built with Flask that manages fruits in a store.
The project also includes **logging**, a **log monitoring script**, and **automated testing script** with clear pass/fail output. The project also includes **logging**, a **log monitoring script**, and **automated testing script** with clear pass/fail output . This project uses **GitHub Actions Continuous Integration (CI)** to ensure the API works correctly after every code change .
---
## 📂 Project Structure ## 📂 Project Structure
``` ```
fruit-api/ fruit-api/
@@ -33,7 +33,7 @@ fruit-api/
- `CI/CD` pipeline for automated testing - `CI/CD` pipeline for automated testing
---
## ⚙️ Setup Instructions ## ⚙️ Setup Instructions
@@ -61,10 +61,10 @@ or
python3 fruit_api.py python3 fruit_api.py
``` ```
API will start at: API will start at :
👉 `http://localhost:5000` 👉 `http://localhost:5000`
---
## 🚀 API Endpoints ## 🚀 API Endpoints
@@ -86,7 +86,7 @@ http://localhost:5000
| GET | `/fruits/search?name=<name>` | Search fruits by name | | GET | `/fruits/search?name=<name>` | Search fruits by name |
| GET | `/health` | Health check | | GET | `/health` | Health check |
---
## 📑 Example Usage (with curl) ## 📑 Example Usage (with curl)
@@ -119,7 +119,7 @@ Example log:
2025-09-29 18:05:22 - IP:127.0.0.1 - METHOD:GET - ENDPOINT:/fruits - STATUS:200 2025-09-29 18:05:22 - IP:127.0.0.1 - METHOD:GET - ENDPOINT:/fruits - STATUS:200
``` ```
---
## 🔎 Monitoring (log_monitor.sh) ## 🔎 Monitoring (log_monitor.sh)
@@ -134,11 +134,11 @@ Run it in background:
bash log_monitor.sh & bash log_monitor.sh &
``` ```
---
## 🤖 API Testing (test_api.sh) ## 🤖 API Testing (test_api.sh)
The `test_api.sh` script: The `test_api.sh` script :
- Runs automated `GET`, `POST`, `PUT`, `DELETE` requests - Runs automated `GET`, `POST`, `PUT`, `DELETE` requests
- Prints ✅ if the status is correct (200/201), ❌ otherwise - Prints ✅ if the status is correct (200/201), ❌ otherwise
- Logs results in `test_results.log` - Logs results in `test_results.log`
@@ -159,18 +159,15 @@ Example output:
✅ All tests passed! ✅ All tests passed!
``` ```
---
## 📘 Swagger Documentation ## 📘 Swagger Documentation
After starting the API, open: After starting the API, open:
👉 [http://localhost:5000/docs](http://localhost:5000/docs) 👉 [http://localhost:5000/docs](http://localhost:5000/docs)
---
## ⚡ CI/CD Pipeline ## ⚡ CI/CD Pipeline
This project uses **Continuous Integration (CI)** to ensure the API works correctly after every code change.
### Workflow ### Workflow
- Triggered on every **push** or **pull request** to `main` branch. - Triggered on every **push** or **pull request** to `main` branch.
- Installs dependencies (`requirements.txt`). - Installs dependencies (`requirements.txt`).
@@ -178,7 +175,6 @@ This project uses **Continuous Integration (CI)** to ensure the API works correc
- Runs automated tests (`test_api.sh`). - Runs automated tests (`test_api.sh`).
- Pipeline **fails** if any test ❌ fails. - Pipeline **fails** if any test ❌ fails.
---
## 🐳 Docker Support ## 🐳 Docker Support