api.php 1009 B

123456789101112131415161718192021222324252627282930313233
  1. <?php
  2. /*
  3. |--------------------------------------------------------------------------
  4. | Application Routes
  5. |--------------------------------------------------------------------------
  6. |
  7. | Here is where you can register all of the routes for an application.
  8. | It is a breeze. Simply tell Lumen the URIs it should respond to
  9. | and give it the Closure to call when that URI is requested.
  10. |
  11. */
  12. $api = app('Dingo\Api\Routing\Router');
  13. $api->version('v1', [
  14. 'namespace' => 'App\Http\Controllers',
  15. ], function ($api) {
  16. $api->post('upload', 'UploadController@uploadImage');
  17. $api->group(['middleware' => 'auth:api'], function ($api) {
  18. //注册
  19. $api->post('reg', 'AuthController@register');
  20. //登出
  21. $api->post('logout', 'AuthController@logout');
  22. //刷新身份令牌
  23. $api->post('refresh', 'AuthController@refresh');
  24. });
  25. $api->group(['middleware' => 'jwt.chxq_auth'], function ($api) {
  26. $api->get('user', 'UserController@index');
  27. });
  28. });