api.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  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->group(['namespace' => 'Post'], function ($api) {
  17. //发布内容
  18. $api->post('post', 'PostController@create');
  19. //内容列表
  20. $api->get('post', 'PostController@index');
  21. //内容详情
  22. $api->get('post/detail', 'PostController@detail');
  23. //推荐内容
  24. $api->put('post/suggest', 'PostController@suggest');
  25. //删除内容
  26. $api->delete('post/delete', 'PostController@delete');
  27. //隐藏内容
  28. $api->put('post/hide', 'PostController@hide');
  29. });
  30. $api->group(['middleware' => 'jwt.chxq_auth'], function ($api) {
  31. //配置
  32. $api->get('config', 'ConfigController@index');
  33. });
  34. });