routes.php 625 B

123456789101112131415161718192021222324
  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. $app->get('/short-hits', ['uses' => 'ApiController@getShortUrlHits']);
  14. });
  15. $app->group([
  16. 'namespace' => 'App\Api\Controllers',
  17. 'prefix' => ''
  18. ], function () use ($app) {
  19. $app->get('/{plink:[A-Za-z0-9]+}',[
  20. 'as' => 'moduleIndex', 'uses' => 'IndexController@index'
  21. ]);
  22. });