feat: Ghayma Assessment - complete submission
هذا الالتزام موجود في:
77
README.md
Normal file
77
README.md
Normal file
@@ -0,0 +1,77 @@
|
||||
# Ghayma REST API Application
|
||||
|
||||
A simple, lightweight Node.js Express REST API application with container support.
|
||||
|
||||
## 🚀 Features
|
||||
|
||||
- **Express.js** lightweight web framework
|
||||
- **CORS & JSON Middleware** pre-configured
|
||||
- **Health Check Endpoint** (`/health`) for Docker/Kubernetes probes
|
||||
- **Resource CRUD API** (`/api/v1/items`)
|
||||
- **Docker Support** with health checks and optimized `.dockerignore`
|
||||
|
||||
---
|
||||
|
||||
## 🛠️ Endpoints Overview
|
||||
|
||||
| Method | Endpoint | Description |
|
||||
| :--- | :--- | :--- |
|
||||
| `GET` | `/` | API Metadata & Welcome Info |
|
||||
| `GET` | `/health` | Application Health & Uptime Status |
|
||||
| `GET` | `/api/v1/items` | List all items |
|
||||
| `GET` | `/api/v1/items/:id` | Get item by ID |
|
||||
| `POST` | `/api/v1/items` | Create new item |
|
||||
| `DELETE` | `/api/v1/items/:id` | Delete item by ID |
|
||||
|
||||
---
|
||||
|
||||
## 💻 Running Locally
|
||||
|
||||
### Prerequisites
|
||||
- Node.js (v18+)
|
||||
|
||||
### Steps
|
||||
1. Install dependencies:
|
||||
```bash
|
||||
npm install
|
||||
```
|
||||
|
||||
2. Start the API server:
|
||||
```bash
|
||||
npm start
|
||||
```
|
||||
Or for development auto-reload (Node 18+):
|
||||
```bash
|
||||
npm run dev
|
||||
```
|
||||
|
||||
3. Test the server:
|
||||
Navigate to `http://localhost:3000` or run:
|
||||
```bash
|
||||
curl http://localhost:3000/health
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🐳 Running with Docker
|
||||
|
||||
### Build the Docker Image
|
||||
```bash
|
||||
docker build -t ghayma-api .
|
||||
```
|
||||
|
||||
### Run the Container
|
||||
```bash
|
||||
docker run -d -p 3000:3000 --name ghayma-api-app ghayma-api
|
||||
```
|
||||
|
||||
### Test Containerized API
|
||||
```bash
|
||||
curl http://localhost:3000/api/v1/items
|
||||
```
|
||||
|
||||
### Stop Container
|
||||
```bash
|
||||
docker stop ghayma-api-app
|
||||
docker rm ghayma-api-app
|
||||
```
|
||||
المرجع في مشكلة جديدة
حظر مستخدم