Initial deployment
هذا الالتزام موجود في:
38
app.py
Normal file
38
app.py
Normal file
@@ -0,0 +1,38 @@
|
||||
from flask import Flask, jsonify
|
||||
import time
|
||||
|
||||
app = Flask(__name__)
|
||||
|
||||
request_count = 0
|
||||
start_time = time.time()
|
||||
|
||||
|
||||
@app.route("/")
|
||||
def home():
|
||||
global request_count
|
||||
request_count += 1
|
||||
return jsonify({
|
||||
"message": "Hello from Ghaymah!",
|
||||
"timestamp": time.time()
|
||||
})
|
||||
|
||||
|
||||
@app.route("/health")
|
||||
def health():
|
||||
global request_count
|
||||
request_count += 1
|
||||
return jsonify({
|
||||
"status": "healthy"
|
||||
})
|
||||
|
||||
|
||||
@app.route("/metrics")
|
||||
def metrics():
|
||||
return jsonify({
|
||||
"request_count": request_count,
|
||||
"uptime": round(time.time() - start_time, 2)
|
||||
})
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
app.run(host="0.0.0.0", port=5000)
|
||||
المرجع في مشكلة جديدة
حظر مستخدم