// Setup response formats $formats = []; $formats["json"] = new response\JsonResponseFormat(false); $formats["json/pretty"] = new response\JsonResponseFormat(true); $formats["xml"] = new response\XMLResponseFormat(); // Get response response if provided $responseFormat = DEFAULT_FORMAT; if (array_key_exists(Headers::RESPONSE_FORMAT, $_SERVER)) { $responseFormat = $_SERVER[Headers::RESPONSE_FORMAT]; } error_reporting(DEBUG ? E_ALL : 0); require_once 'core/Utils.php'; require_once 'Routes.php'; // Setup config core\Config::loadConfig(); database\Database::init(); // Request from the same server don't have a HTTP_ORIGIN if (!array_key_exists('HTTP_ORIGIN', $_SERVER)) { $_SERVER['HTTP_ORIGIN'] = $_SERVER['SERVER_NAME']; } // Get response response if provided $responseFormat = DEFAULT_FORMAT; if (array_key_exists(Headers::RESPONSE_FORMAT, $_SERVER)) { $responseFormat = $_SERVER[Headers::RESPONSE_FORMAT]; } $code = HTTP::INTERNAL_ERROR; $payload = []; // get the requested endpoint $request = strtolower($_REQUEST['request']); // Sanitize the request if (strlen($request) != 0 && ends_with($request, "/")) {