forked from grocy/grocy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.php
44 lines (37 loc) · 1006 Bytes
/
app.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
42
43
44
<?php
use \Psr\Http\Message\ServerRequestInterface as Request;
use \Psr\Http\Message\ResponseInterface as Response;
use \Grocy\Helpers\UrlManager;
use \Grocy\Controllers\LoginController;
require_once __DIR__ . '/vendor/autoload.php';
require_once __DIR__ . '/data/config.php';
// Setup base application
$appContainer = new \Slim\Container([
'settings' => [
'displayErrorDetails' => true,
'determineRouteBeforeAppMiddleware' => true
],
'view' => function($container)
{
return new \Slim\Views\Blade(__DIR__ . '/views', __DIR__ . '/data/viewcache');
},
'LoginControllerInstance' => function($container)
{
return new LoginController($container, 'grocy_session');
},
'UrlManager' => function($container)
{
return new UrlManager(BASE_URL);
},
'ApiKeyHeaderName' => function($container)
{
return 'GROCY-API-KEY';
}
]);
$app = new \Slim\App($appContainer);
if (PHP_SAPI === 'cli')
{
$app->add(\pavlakis\cli\CliRequest::class);
}
require_once __DIR__ . '/routes.php';
$app->run();