You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
961 B

"""Главный blueprint — посадочная страница и health-чек.
В E1.0 здесь нет бизнес-логики; страницы и эндпоинты добавляются в следующих
спринтах (E1.1 — auth, E1.2 — тесты, и т.д.).
"""
from __future__ import annotations
from flask import Blueprint, jsonify, render_template
from .. import db as app_db
from ..auth.decorators import login_required
main_bp = Blueprint('main', __name__)
@main_bp.route('/health')
def health():
"""Smoke-проверка приложения и подключений к БД (без авторизации)."""
db_status = app_db.ping()
overall = 'ok' if db_status.get('main') == 'ok' else 'degraded'
return jsonify(
status=overall,
service='testing-flask-app',
db=db_status,
)
@main_bp.route('/')
@login_required
def index():
return render_template('index.html')