api.php 869 B

1234567891011121314151617181920212223242526272829
  1. <?php
  2. use Illuminate\Http\Request;
  3. /*
  4. |--------------------------------------------------------------------------
  5. | API Routes
  6. |--------------------------------------------------------------------------
  7. |
  8. | Here is where you can register API routes for your application. These
  9. | routes are loaded by the RouteServiceProvider within a group which
  10. | is assigned the "api" middleware group. Enjoy building your API!
  11. |
  12. */
  13. $api = app('Dingo\Api\Routing\Router');
  14. $api->version('v1',[
  15. 'namespace'=>'App\Http\Controllers'
  16. ],function ($api){
  17. $api->get('index','IndexController@index');
  18. $api->get('course_img','IndexController@course_img');
  19. $api->get('code','IndexController@code');
  20. $api->group(['middleware'=>'jwttoken'],function ($api){
  21. $api->get('user',function (Request $request){
  22. return $request->user();
  23. });
  24. });
  25. });