feat: projeto ranking com JWT configurado

This commit is contained in:
2026-04-24 13:17:25 -05:00
parent 2245afdb43
commit 1025d48877
3 changed files with 66 additions and 8 deletions

View File

@@ -3,23 +3,30 @@
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Route;
use App\Http\Controllers\GameController;
/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider and all of them will
| be assigned to the "api" middleware group. Make something great!
|
*/
Route::prefix('v1')->group(function () {
Route::prefix('v1')->middleware(['jwt.auth'])->group(function () {
// Rankings
Route::get('/rankings/weekly', [GameController::class, 'weeklyRanking']);
Route::get('/rankings/monthly', [GameController::class, 'monthlyRanking']);
Route::get('/rankings/yearly', [GameController::class, 'yearlyRanking']);
Route::get('/rankings/history/{id}', [GameController::class, 'history']);
Route::get('/games/most-played', [GameController::class, 'mostPlayed']);
Route::get('/rankings/platforms/{platform}', [GameController::class, 'platformRanking']);
// Jogos
Route::get('/games/most-played', [GameController::class, 'mostPlayed']);
});
// 🔓 Rota de teste (opcional)
Route::middleware(['jwt.auth'])->get('/test-auth', function (Request $request) {
return response()->json([
'userId' => $request->attributes->get('auth')['id']
]);
});