File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -4,4 +4,5 @@ __pycache__/
44.env
55.envrc
66.DS_Store
7- ca-certificate.crt
7+ ca-certificate.crt
8+ firebase-service-account-key.json
Original file line number Diff line number Diff line change 99
1010load_dotenv ()
1111
12- from flask import Flask , request , g
12+ from flask import Flask , jsonify , request , g
1313from flask_cors import CORS
1414from flask_jwt_extended import JWTManager
1515from flask_graphql import GraphQLView
2121from src .services .article_service import ArticleService
2222from src .utils .constants import JWT_SECRET_KEY
2323from src .utils .team_loader import TeamLoader
24- from src .database import db
24+ from src .database import db , client
2525
2626app = Flask (__name__ )
2727
@@ -104,6 +104,15 @@ def create_context():
104104 return {"team_loader" : TeamLoader ()}
105105
106106
107+ @app .route ("/health" )
108+ def health_check ():
109+ try :
110+ client .admin .command ("ping" )
111+ return jsonify ({"status" : "healthy" , "database" : "connected" }), 200
112+ except Exception :
113+ return jsonify ({"status" : "unhealthy" , "database" : "disconnected" }), 503
114+
115+
107116app .add_url_rule (
108117 "/graphql" ,
109118 view_func = GraphQLView .as_view (
You can’t perform that action at this time.
0 commit comments