1
|
<?php
|
2
|
|
3
|
require_once __DIR__.'/../vendor/autoload.php';
|
4
|
|
5
|
try {
|
6
|
(new Dotenv\Dotenv(__DIR__.'/../'))->load();
|
7
|
} catch (Dotenv\Exception\InvalidPathException $e) {
|
8
|
//
|
9
|
}
|
10
|
|
11
|
/*
|
12
|
|--------------------------------------------------------------------------
|
13
|
| Create The Application
|
14
|
|--------------------------------------------------------------------------
|
15
|
|
|
16
|
| Here we will load the environment and create the application instance
|
17
|
| that serves as the central piece of this framework. We'll use this
|
18
|
| application as an "IoC" container and router for this framework.
|
19
|
|
|
20
|
*/
|
21
|
|
22
|
$app = new Laravel\Lumen\Application(
|
23
|
realpath(__DIR__.'/../')
|
24
|
);
|
25
|
|
26
|
$app->withFacades();
|
27
|
|
28
|
$app->withEloquent();
|
29
|
|
30
|
/*
|
31
|
|--------------------------------------------------------------------------
|
32
|
| Register Container Bindings
|
33
|
|--------------------------------------------------------------------------
|
34
|
|
|
35
|
| Now we will register a few bindings in the service container. We will
|
36
|
| register the exception handler and the console kernel. You may add
|
37
|
| your own bindings here if you like or you can make another file.
|
38
|
|
|
39
|
*/
|
40
|
|
41
|
$app->singleton(
|
42
|
Illuminate\Contracts\Debug\ExceptionHandler::class,
|
43
|
App\Exceptions\Handler::class
|
44
|
);
|
45
|
|
46
|
$app->singleton(
|
47
|
Illuminate\Contracts\Console\Kernel::class,
|
48
|
App\Console\Kernel::class
|
49
|
);
|
50
|
|
51
|
/*
|
52
|
|--------------------------------------------------------------------------
|
53
|
| Register Middleware
|
54
|
|--------------------------------------------------------------------------
|
55
|
|
|
56
|
| Next, we will register the middleware with the application. These can
|
57
|
| be global middleware that run before and after each request into a
|
58
|
| route or middleware that'll be assigned to some specific routes.
|
59
|
|
|
60
|
*/
|
61
|
|
62
|
$app->routeMiddleware([
|
63
|
'jwtauth' => App\Http\Middleware\JWTAuthenticate::class,
|
64
|
]);
|
65
|
|
66
|
/**
|
67
|
* Cors middleware, ktery zpracuje OPTION requesty.
|
68
|
*/
|
69
|
$app->middleware([
|
70
|
App\Http\Middleware\CorsMiddleware::class
|
71
|
]);
|
72
|
|
73
|
// $app->routeMiddleware([
|
74
|
// 'auth' => App\Http\Middleware\Authenticate::class,
|
75
|
// ]);
|
76
|
|
77
|
/*
|
78
|
|--------------------------------------------------------------------------
|
79
|
| Register Service Providers
|
80
|
|--------------------------------------------------------------------------
|
81
|
|
|
82
|
| Here we will register all of the application's service providers which
|
83
|
| are used to bind services into the container. Service providers are
|
84
|
| totally optional, so you are not required to uncomment this line.
|
85
|
|
|
86
|
*/
|
87
|
|
88
|
// $app->register(App\Providers\AppServiceProvider::class);
|
89
|
// $app->register(App\Providers\AuthServiceProvider::class);
|
90
|
// $app->register(App\Providers\EventServiceProvider::class);
|
91
|
|
92
|
/*
|
93
|
|--------------------------------------------------------------------------
|
94
|
| Load The Application Routes
|
95
|
|--------------------------------------------------------------------------
|
96
|
|
|
97
|
| Next we will include the routes file so that they can all be added to
|
98
|
| the application. This will provide all of the URLs the application
|
99
|
| can respond to, as well as the controllers that may handle them.
|
100
|
|
|
101
|
*/
|
102
|
|
103
|
$app->group(['namespace' => 'App\Http\Controllers'], function ($app) {
|
104
|
require __DIR__.'/../app/Http/routes.php';
|
105
|
});
|
106
|
|
107
|
return $app;
|