feat: 为玩家和管理员模块新增 API 路由与中间件别名
This commit is contained in:
30
routes/api.php
Normal file
30
routes/api.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
use App\Http\Controllers\Api\V1\Admin\PingController as AdminPingController;
|
||||
use App\Http\Controllers\Api\V1\HealthController;
|
||||
use App\Http\Controllers\Api\V1\Player\PingController as PlayerPingController;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
|
||||
/*
|
||||
| 全局前缀已由 bootstrap 注册为 /api,本文件内为相对路径。
|
||||
| 玩家端:/api/v1/player/...
|
||||
| 后台: /api/v1/admin/...
|
||||
*/
|
||||
|
||||
Route::prefix('v1')->group(function (): void {
|
||||
Route::get('health', HealthController::class)->name('api.v1.health');
|
||||
|
||||
Route::middleware('lottery.player')
|
||||
->prefix('player')
|
||||
->name('api.v1.player.')
|
||||
->group(function (): void {
|
||||
Route::get('ping', PlayerPingController::class)->name('ping');
|
||||
});
|
||||
|
||||
Route::middleware('lottery.admin')
|
||||
->prefix('admin')
|
||||
->name('api.v1.admin.')
|
||||
->group(function (): void {
|
||||
Route::get('ping', AdminPingController::class)->name('ping');
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user