1 |
54fa168c
|
Cajova-Houba
|
<?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 |
d58f0fda
|
Cajova-Houba
|
$app->withFacades();
|
27 |
54fa168c
|
Cajova-Houba
|
|
28 |
d58f0fda
|
Cajova-Houba
|
$app->withEloquent();
|
29 |
54fa168c
|
Cajova-Houba
|
|
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 |
a800985e
|
Cajova-Houba
|
$app->routeMiddleware([
|
63 |
|
|
'jwtauth' => App\Http\Middleware\JWTAuthenticate::class,
|
64 |
9bc023de
|
Cajova-Houba
|
'cors' => App\Http\Middleware\CorsMiddleware::class
|
65 |
a800985e
|
Cajova-Houba
|
]);
|
66 |
|
|
|
67 |
f435f63d
|
Cajova-Houba
|
/**
|
68 |
|
|
* Cors middleware, ktery zpracuje OPTION requesty.
|
69 |
|
|
*/
|
70 |
9bc023de
|
Cajova-Houba
|
//$app->middleware([
|
71 |
|
|
//]);
|
72 |
54fa168c
|
Cajova-Houba
|
|
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 |
cb15593b
|
Cajova-Houba
|
$app->group(['namespace' => 'App\Http\Controllers'], function ($app) {
|
104 |
|
|
require __DIR__.'/../app/Http/routes.php';
|
105 |
54fa168c
|
Cajova-Houba
|
});
|
106 |
|
|
|
107 |
|
|
return $app;
|