refactor(api): restructure root response to include versions
This commit is contained in:
parent
c5867c7926
commit
a738fed493
2 changed files with 13 additions and 3 deletions
|
|
@ -6,8 +6,15 @@ use Illuminate\Support\Facades\Config;
|
|||
use Illuminate\Support\Facades\Route;
|
||||
|
||||
// * Api Root URL
|
||||
Route::get('/', fn () => response()->json(Config::string('app.name') . ' please choose a version'))
|
||||
->name('api.root');
|
||||
Route::get(
|
||||
'/',
|
||||
fn () => response()->json([
|
||||
'message' => Config::string('app.name') . ' please choose a version',
|
||||
'versions' => [
|
||||
'v1' => route('api.v1.root'),
|
||||
],
|
||||
])
|
||||
)->name('api.root');
|
||||
|
||||
// * V1 API
|
||||
Route::prefix('v1')->name('api.v1.')->group(function () {
|
||||
|
|
|
|||
|
|
@ -7,7 +7,10 @@ use Illuminate\Support\Facades\Route;
|
|||
use Presentation\Api\V1\Http\Controllers\Employees\EmployeeShowController;
|
||||
use Presentation\Api\V1\Http\Controllers\Employees\EmployeesIndexController;
|
||||
|
||||
Route::get('/', fn () => response()->json(Config::string('app.name') . ' v1'))->name('root');
|
||||
Route::get('/', fn () => response()->json([
|
||||
'message' => Config::string('app.name') . ' v1',
|
||||
'spec' => route('api.v1.openapi'),
|
||||
]))->name('root');
|
||||
|
||||
Route::get('/ping', fn () => response()->json('pong'))->name('ping');
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue