Skip to content

Commit 541a883

Browse files
committed
added /about endpoint for app info
1 parent 6ab7fa7 commit 541a883

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

routes/api.php

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22

33
use App\Http\Controllers\API\HealthCheckController;
44
use App\Http\Controllers\API\Speedtest\GetLatestController;
5-
use Illuminate\Http\Request;
5+
use Illuminate\Support\Facades\Artisan;
66
use Illuminate\Support\Facades\Route;
7+
use Symfony\Component\Console\Output\BufferedOutput;
78

89
/*
910
|--------------------------------------------------------------------------
@@ -16,8 +17,21 @@
1617
|
1718
*/
1819

19-
Route::middleware('auth:sanctum')->get('/user', function (Request $request) {
20-
return $request->user();
20+
Route::middleware('auth:sanctum')->group(function () {
21+
/**
22+
* About endpoint will return the current status of the application including it's version.
23+
*
24+
* Endpoint: /api/about
25+
*/
26+
Route::get('/about', function () {
27+
$output = new BufferedOutput();
28+
29+
Artisan::call('about --json', [], $output);
30+
31+
$response = json_decode($output->fetch(), true);
32+
33+
return response()->json($response);
34+
});
2135
});
2236

2337
Route::get('/healthcheck', HealthCheckController::class);

0 commit comments

Comments
 (0)