diff --git a/App/Config.php b/App/Config.php index 54e6fdc..8bef0fa 100644 --- a/App/Config.php +++ b/App/Config.php @@ -2,6 +2,8 @@ namespace App; + + /** * Application configuration * @@ -19,6 +21,7 @@ class Config * @var string */ const DB_NAME = 'background'; + const ROUTE_PREFIX_DEV = "/api/public/"; const ROUTE_PREFIX = "/wapi/"; /** * Database user @@ -36,3 +39,4 @@ class Config */ const SHOW_ERRORS = true; } + diff --git a/public/index.php b/public/index.php index bf46763..47f8fbc 100644 --- a/public/index.php +++ b/public/index.php @@ -23,8 +23,11 @@ $router = new Core\Router(); $router->add('', ['controller' => 'Home', 'action' => 'index']); $router->add('{controller}/{action}'); $router->add('{controller}/{action}/{id:.+}'); +if($_SERVER['HTTP_HOST'] == '127.0.0.1') + $router->AddPrefix(\App\Config::ROUTE_PREFIX_DEV); +else + $router->AddPrefix(\App\Config::ROUTE_PREFIX); -$router->AddPrefix(\App\Config::ROUTE_PREFIX); try{ //for prefight request if($_SERVER['REQUEST_METHOD'] == 'OPTIONS'){