48159b643fc7c40eb29d2b27a43d3127f3e7a77e
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 |
/metrics |
API Request Metrics (Latency, Counts, Status) |
GET |
/dashboard |
API Internal Monitoring Dashboard UI |
GET |
/monitoring |
External Platform Monitoring Dashboard (mithal.space) |
GET |
/api/monitoring/metrics |
External Monitoring Data (from Python collector) |
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
-
Install dependencies:
npm install -
Start the API server:
npm startOr for development auto-reload (Node 18+):
npm run dev -
Test the server: Navigate to
http://localhost:3000or run:curl http://localhost:3000/health
🐳 Running with Docker
Build the Docker Image
docker build -t ghayma-api .
Run the Container
docker run -d -p 3000:3000 --name ghayma-api-app ghayma-api
Test Containerized API
curl http://localhost:3000/api/v1/items
Stop Container
docker stop ghayma-api-app
docker rm ghayma-api-app
الوصف
اللغات
HTML
77.8%
Python
21.7%
Dockerfile
0.5%