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

  1. Install dependencies:

    npm install
    
  2. Start the API server:

    npm start
    

    Or for development auto-reload (Node 18+):

    npm run dev
    
  3. Test the server: Navigate to http://localhost:3000 or 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
الوصف
Ghayma Assesment
اقرأني 5.4 MiB
اللغات
HTML 77.8%
Python 21.7%
Dockerfile 0.5%