26 lines
549 B
PHP
26 lines
549 B
PHP
<?php
|
|
|
|
namespace Slovocast\Controller;
|
|
|
|
use Slovocast\Controller\Controller;
|
|
use React\Mysql\MysqlClient;
|
|
use function React\Async\await;
|
|
use Psr\Http\Message\ResponseInterface as Response;
|
|
|
|
class HealthCheck extends Controller
|
|
{
|
|
public function __construct(
|
|
protected MysqlClient $db
|
|
) { }
|
|
|
|
public function handle(): Response
|
|
{
|
|
$results = await($this->db->query("SELECT 1"));
|
|
|
|
return $this->json([
|
|
'http' => true,
|
|
'database' => (bool) count($results->resultRows),
|
|
]);
|
|
}
|
|
}
|