-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
41 lines (29 loc) · 987 Bytes
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<?php
define('DS', DIRECTORY_SEPARATOR);
define('ROOT', __DIR__ . DS);
use Cake\Datasource\ConnectionManager;
use DI\ContainerBuilder;
use Slim\Factory\AppFactory;
use josegonzalez\Dotenv\Loader;
require_once __DIR__ . DS . 'vendor' . DS . 'autoload.php';
require_once __DIR__ . DS . 'config' . DS . 'bootstrap.php';
$config_file = __DIR__ . DS . 'config' . DS . '.env';
if (file_exists($config_file)) {
(new Loader($config_file))
->parse()
->toEnv();
}
ConnectionManager::setConfig('default', [
'url' => env('CLEARDB_DATABASE_URL'),
]);
$builder = (new ContainerBuilder())
->useAutowiring(false)
->useAnnotations(false)
->addDefinitions(__DIR__ . DS . 'config' . DS . 'dependencies.php');
$container = $builder->build();
AppFactory::setContainer($container);
$app = AppFactory::create();
require_once __DIR__ . DS . 'config' . DS . 'routes.php';
$app->addBodyParsingMiddleware();
$app->addErrorMiddleware(true, true, true);
$app->run();