الملفات
ghaymah-exam-MohamedSaleh-SRE/app.py
2026-07-26 19:36:57 +00:00

47 أسطر
1016 B
Python

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():
global request_count
request_count += 1
@app.route("/")
def home():
return """
<html>
<head>
<title>Ghaymah API</title>
</head>
<body style="font-family:Arial;text-align:center;margin-top:80px;">
<h1>🚀 Ghaymah Systems API</h1>
<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 jsonify({
"status": "healthy",
"uptime": round(time.time() - start_time, 2),
"requests": request_count
})
if __name__ == "__main__":
app.run(host="0.0.0.0", port=5000)