Просмотр исходного кода

feat(header): add new navigation item for API Docs2
fix(middleware): update matcher to include reference path
feat(reference): implement route for API reference

vtugulan 6 месяцев назад
Родитель
Сommit
ef8e2dbbaf
3 измененных файлов с 15 добавлено и 1 удалено
  1. 6 0
      app/components/header.tsx
  2. 8 0
      app/reference/route.ts
  3. 1 1
      middleware.ts

+ 6 - 0
app/components/header.tsx

@@ -31,6 +31,12 @@ const navigationItems = [
     description: "View API documentation",
     icon: FileText,
   },
+  {
+    title: "API Docs2",
+    href: "/reference",
+    description: "View API documentation",
+    icon: FileText,
+  },
 ];
 
 const userMenuItems = [

+ 8 - 0
app/reference/route.ts

@@ -0,0 +1,8 @@
+// app/reference/route.ts
+import { ApiReference } from '@scalar/nextjs-api-reference'
+
+const config = {
+  url: '/api/openapi.json',
+}
+
+export const GET = ApiReference(config)

+ 1 - 1
middleware.ts

@@ -5,5 +5,5 @@ export default function middleware(request: Request) {
 }
 
 export const config = {
-  matcher: ["/files/:path*", "/api-docs/:path*", "/api/:path*"],
+  matcher: ["/files/:path*", "/api-docs/:path*", "/api/:path*", "/reference/:path*"],
 };