Restore platform route and db diagnostics
This commit is contained in:
@@ -1,6 +1,15 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
Route::get('/', function () {
|
||||
return response()->json([
|
||||
'status' => 'ok',
|
||||
'service' => 'api-ranking-jogos',
|
||||
]);
|
||||
});
|
||||
|
||||
Route::get('/health', function () {
|
||||
return response()->json(['status' => 'ok']);
|
||||
@@ -18,3 +27,22 @@ Route::get('/health-check-key', function () {
|
||||
'openssl_error' => openssl_error_string(),
|
||||
]);
|
||||
});
|
||||
|
||||
Route::get('/health-check-db', function () {
|
||||
try {
|
||||
$hasGamesTable = Schema::hasTable('games');
|
||||
|
||||
return response()->json([
|
||||
'connection' => config('database.default'),
|
||||
'driver' => DB::connection()->getDriverName(),
|
||||
'database' => DB::connection()->getDatabaseName(),
|
||||
'games_table_exists' => $hasGamesTable,
|
||||
'games_count' => $hasGamesTable ? DB::table('games')->count() : null,
|
||||
]);
|
||||
} catch (Throwable $e) {
|
||||
return response()->json([
|
||||
'connection' => config('database.default'),
|
||||
'error' => $e->getMessage(),
|
||||
], 500);
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user