Added an open healthcheck API endpoint.

This commit is contained in:
Abdulmhsen B. A. A
2024-04-27 11:50:41 +03:00
parent b227778eb1
commit d7d49d9a5d
2 changed files with 26 additions and 2 deletions

View File

@@ -0,0 +1,24 @@
<?php
declare(strict_types=1);
namespace App\API\System;
use App\Libs\Attributes\Route\Get;
use App\Libs\HTTP_STATUS;
use Psr\Http\Message\ResponseInterface as iResponse;
use Psr\Http\Message\ServerRequestInterface as iRequest;
final class HealthCheck
{
public const string URL = '%{api.prefix}/system/healthcheck';
#[Get(self::URL . '[/]', name: 'system.healthcheck')]
public function __invoke(iRequest $request): iResponse
{
return api_response(HTTP_STATUS::HTTP_OK, [
'status' => 'ok',
'message' => 'System is healthy',
]);
}
}