Added an open healthcheck API endpoint.
This commit is contained in:
24
src/API/System/HealthCheck.php
Normal file
24
src/API/System/HealthCheck.php
Normal 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',
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user