هذا الالتزام موجود في:
root
2026-07-26 19:36:57 +00:00
الأصل 7aa9b47b2a
التزام 220e88fdb3
3 ملفات معدلة مع 21 إضافات و60 حذوفات

76
app.py
عرض الملف

@@ -1,9 +1,10 @@
from flask import Flask
from flask import Flask, jsonify, send_from_directory
import time
app = Flask(__name__)
request_count = 0
start_time = time.time()
@app.before_request
def count_requests():
@@ -12,77 +13,34 @@ def count_requests():
@app.route("/")
def home():
return f"""
<!DOCTYPE html>
return """
<html>
<head>
<title>Ghaymah Systems API</title>
<style>
body {{
font-family: Arial, sans-serif;
background: #f4f4f4;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
margin: 0;
}}
.card {{
background: white;
padding: 40px;
border-radius: 10px;
box-shadow: 0 4px 10px rgba(0,0,0,0.2);
text-align: center;
}}
h1 {{
color: #2c3e50;
}}
p {{
color: #555;
font-size: 18px;
}}
a {{
display: inline-block;
margin-top: 20px;
padding: 10px 20px;
background: #007BFF;
color: white;
text-decoration: none;
border-radius: 5px;
}}
a:hover {{
background: #0056b3;
}}
</style>
<title>Ghaymah API</title>
</head>
<body>
<body style="font-family:Arial;text-align:center;margin-top:80px;">
<h1>🚀 Ghaymah Systems API</h1>
<div class="card">
<h1>🚀 Ghaymah Systems API</h1>
<p>The API is running successfully.</p>
<p><strong>Total Requests:</strong> {request_count}</p>
<a href="/health">Health Check</a>
</div>
<p>Application is running successfully.</p>
<a href="/health">Health Endpoint</a>
<br><br>
<a href="/dashboard">Monitoring Dashboard</a>
</body>
</html>
"""
@app.route("/dashboard")
def dashboard():
return send_from_directory("q1-deploy-monitor", "dashboard.html")
@app.route("/health")
def health():
return {
return jsonify({
"status": "healthy",
"timestamp": int(time.time()),
"uptime": round(time.time() - start_time, 2),
"requests": request_count
}
})
if __name__ == "__main__":
app.run(host="0.0.0.0", port=5000)

عرض الملف

@@ -8,6 +8,9 @@ RUN pip install --no-cache-dir -r requirements.txt
COPY app.py .
# Copy the dashboard folder
COPY q1-deploy-monitor q1-deploy-monitor
EXPOSE 5000
CMD ["python", "app.py"]

عرض الملف

@@ -65,7 +65,7 @@ const start=performance.now();
try{
const response=await fetch("http://localhost:5000/health");
const response=await fetch("/health");
const data=await response.json();
const latency=(performance.now()-start).toFixed(2);