BS-001 Initialize BortStack foundation and project workflow
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
from settings import app
|
||||
from sqlalchemy import text
|
||||
from sqlalchemy.exc import SQLAlchemyError
|
||||
from settings import db
|
||||
from .token_routes import * # noqa: F401 F403
|
||||
from .user_routes import * # noqa: F401 F403
|
||||
from .contact_routes import * # noqa: F401 F403
|
||||
|
||||
|
||||
@app.route("/api/test")
|
||||
def test_route():
|
||||
"""Test."""
|
||||
return {"success": True}
|
||||
|
||||
|
||||
@app.get("/api/health")
|
||||
def health():
|
||||
"""Backward-compatible liveness probe."""
|
||||
return {"status": "ok"}
|
||||
|
||||
|
||||
@app.get("/api/health/live")
|
||||
def health_live():
|
||||
return {"status": "ok"}
|
||||
|
||||
|
||||
@app.get("/api/health/ready")
|
||||
def health_ready():
|
||||
try:
|
||||
db.session.execute(text("SELECT 1"))
|
||||
except SQLAlchemyError:
|
||||
app.logger.error("Database readiness check failed")
|
||||
return {"status": "unavailable"}, 503
|
||||
return {"status": "ready"}
|
||||
Reference in New Issue
Block a user