connect((!defined('REDIS_SERVER'))?'localhost':REDIS_SERVER, (!defined('REDIS_PORT'))?6379:REDIS_PORT); } //parse the URL to an array and filter it $url = array_filter(explode('/',ltrim(parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH),'/'))); if($url[0] == 'api') { array_shift($url); //remove "api" form the URL $a = new API($url); $return = $a->act(); header('Content-Type: application/json'); echo json_encode($return, JSON_PRETTY_PRINT).PHP_EOL; exit(); } //not an API call, so let the architect do its magic $routercall = architect($url); echo $routercall.PHP_EOL;