Skip to content
Snippets Groups Projects
health_check.php 697 B
Newer Older
root's avatar
root committed
<?php
namespace SmartData;

require_once('../bin/smartdata/SmartAPI.php');
use function SmartData\SmartAPI\health_check;
use SmartData\Exception\CustomException;
use SmartData\Logger;

http_response_code(HttpStatusCode::SERVICE_UNAVAILABLE);

header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Headers: Content-Type, Content-length, X-Requested-With');
header("Access-Control-Allow-Methods: POST");

try {
    $response = health_check();
}catch(CustomException $e){
    http_response_code($e->getHTTPCodeError());
    Logger::exception($e);
    return false;
}catch(\Exception $e){
    Logger::exception($e);
    return false;
}

http_response_code(HttpStatusCode::NO_CONTENT);