go-learn/server/api/health.php
sab.code.lab 1c85091186 chore: восстановление репозитория из снапшота v0.3.1
Прежняя git-история утрачена при переносе проекта на машину владельца
(снапшот без .git). Хэши коммитов в docs/reports/* относятся к утраченной
истории.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-07 09:34:02 +02:00

22 lines
522 B
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
declare(strict_types=1);
/**
* GET /api/health.php → 200 {"status":"ok"} (V.6).
* Проверяет доступность БД; при сбое — 503 без текста исключения.
*/
require __DIR__ . '/../lib/http.php';
require __DIR__ . '/../lib/db.php';
http_security_headers();
try {
method_must('GET');
db()->query('SELECT 1');
json_out(['status' => 'ok']);
} catch (Throwable $e) {
error_log('health: ' . $e->getMessage());
json_out(['status' => 'error'], 503);
}