app.php 3.5 KB

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