3 require_once('../vendor/autoload.php');
5 $config = require('../config/app.php');
7 // Allow these origins to do cross domain JS.
8 header("Access-Control-Allow-Origin: " . $config['allow-origin']);
11 if($config['mode'] == 'production') set_exception_handler(array('\Services\StatusReporter', 'exception'));
13 // Everything time related should be UTC+0 based
14 date_default_timezone_set('UTC');
16 // Set up the DI container
17 $containerBuilder = new DI\
ContainerBuilder();
18 $containerBuilder->addDefinitions('../config/DI.php');
19 $containerBuilder->useAutowiring(true
);
21 $container = $containerBuilder->build();
23 /* @var $router Services\Routing\IRouter */
24 $router = $container->get('Services\Routing\IRouter');
26 $controllerName= $router->getControllerName();
27 $controllerAction = $router->getActionName();
28 $controllerActionArgs = $router->getActionArgs();
30 $controller = $container->get('Controllers\\' . ucfirst($controllerName) . 'Controller' );
32 // Last thing to do, call the action on the specified controller.
33 call_user_func_array(array($controller, $controllerAction . 'Action'), $controllerActionArgs);