routes.php 550 B

1234567891011121314151617181920212223
  1. <?php
  2. $app = app()->router;
  3. /**
  4. * pc 无需auth路由
  5. * */
  6. $app->group([
  7. 'namespace' => 'App\Api\Controllers',
  8. 'prefix' => 'api',
  9. ], function () use ($app) {
  10. // 生成短地址
  11. $app->get('/short', ['uses' => 'ApiController@getShortUrl']);
  12. $app->post('/short', ['uses' => 'ApiController@getShortUrl']);
  13. });
  14. $app->group([
  15. 'namespace' => 'App\Api\Controllers',
  16. 'prefix' => ''
  17. ], function () use ($app) {
  18. $app->get('/{plink:[A-Za-z0-9]+}',[
  19. 'as' => 'moduleIndex', 'uses' => 'IndexController@index'
  20. ]);
  21. });