diff --git a/routes/web.php b/routes/web.php index fc6ac1b..4627f41 100644 --- a/routes/web.php +++ b/routes/web.php @@ -5,10 +5,258 @@ use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\Schema; Route::get('/', function () { - return response()->json([ - 'status' => 'ok', - 'service' => 'api-ranking-jogos', - ]); + $baseUrl = request()->root(); + $routes = [ + ['name' => 'base', 'method' => 'GET', 'path' => '/', 'auth' => 'Sem JWT', 'type' => 'open'], + ['name' => 'health', 'method' => 'GET', 'path' => '/health', 'auth' => 'Sem JWT', 'type' => 'open'], + ['name' => 'api_health', 'method' => 'GET', 'path' => '/api/health', 'auth' => 'Sem JWT', 'type' => 'open'], + ['name' => 'health_check_key', 'method' => 'GET', 'path' => '/api/health-check-key', 'auth' => 'Sem JWT', 'type' => 'open'], + ['name' => 'health_check_db', 'method' => 'GET', 'path' => '/api/health-check-db', 'auth' => 'Sem JWT', 'type' => 'open'], + ['name' => 'health_check_token', 'method' => 'GET', 'path' => '/api/health-check-token', 'auth' => 'Bearer para diagnostico', 'type' => 'diagnostic'], + ['name' => 'ranking_semanal', 'method' => 'GET', 'path' => '/api/v1/rankings/weekly', 'auth' => 'JWT obrigatorio', 'type' => 'jwt'], + ['name' => 'ranking_mensal', 'method' => 'GET', 'path' => '/api/v1/rankings/monthly', 'auth' => 'JWT obrigatorio', 'type' => 'jwt'], + ['name' => 'ranking_anual', 'method' => 'GET', 'path' => '/api/v1/rankings/yearly', 'auth' => 'JWT obrigatorio', 'type' => 'jwt'], + ['name' => 'ranking_plataforma', 'method' => 'GET', 'path' => '/api/v1/rankings/platforms/Steam', 'auth' => 'JWT obrigatorio', 'type' => 'jwt'], + ['name' => 'historico_jogador', 'method' => 'GET', 'path' => '/api/v1/rankings/history/1', 'auth' => 'JWT obrigatorio', 'type' => 'jwt'], + ['name' => 'mais_jogados', 'method' => 'GET', 'path' => '/api/v1/games/most-played', 'auth' => 'JWT obrigatorio', 'type' => 'jwt'], + ]; + + $cards = collect($routes)->map(function (array $route) use ($baseUrl) { + $url = $baseUrl . ($route['path'] === '/' ? '' : $route['path']); + $authClass = match ($route['type']) { + 'jwt' => 'auth-jwt', + 'diagnostic' => 'auth-diagnostic', + default => 'auth-open', + }; + + return sprintf( + '
+
+ %s +

%s

+
+
%s
+ %s +
', + e($route['method']), + e($route['name']), + $authClass, + e($route['auth']), + e($url), + e($url), + ); + })->implode(''); + + return response(<< + + + + + API Ranking Jogos + + + +
+
+

API RANKING JOGOS

+

Menu de navegacao - rotas GET disponiveis

+
+ +
+ + Status: ok + Service: api-ranking-jogos +
+ +
+ {$cards} +
+ + +
+ + +HTML); }); Route::get('/health', function () {