diff --git a/routes/web.php b/routes/web.php index 854ec2337..653b5c227 100644 --- a/routes/web.php +++ b/routes/web.php @@ -42,6 +42,7 @@ Route::middleware('auth')->group(function () { ->where('path', '.*$'); // API docs routes + Route::redirect('/api', '/api/docs'); Route::get('/api/docs', [Api\ApiDocsController::class, 'display']); Route::get('/pages/recently-updated', [PageController::class, 'showRecentlyUpdated']); diff --git a/tests/Api/ApiDocsTest.php b/tests/Api/ApiDocsTest.php index 062adce53..56b09cfb8 100644 --- a/tests/Api/ApiDocsTest.php +++ b/tests/Api/ApiDocsTest.php @@ -10,6 +10,12 @@ class ApiDocsTest extends TestCase protected $endpoint = '/api/docs'; + public function test_api_endpoint_redirects_to_docs() + { + $resp = $this->actingAsApiEditor()->get('/api'); + $resp->assertRedirect('api/docs'); + } + public function test_docs_page_returns_view_with_docs_content() { $resp = $this->actingAsApiEditor()->get($this->endpoint);