docs: refactored versioning in api reference + modified v2 content (#7274)

This commit is contained in:
Shahed Nasser
2024-05-09 17:23:49 +03:00
committed by GitHub
parent 6da2964998
commit 5d0ffe8ff4
16 changed files with 1107 additions and 92 deletions

View File

@@ -0,0 +1,18 @@
import { NextResponse } from "next/server"
import type { NextRequest } from "next/server"
export function middleware(request: NextRequest) {
if (
process.env.NEXT_PUBLIC_VERSIONING !== "true" &&
request.url.includes("/v2")
) {
const url = new URL(request.url)
return NextResponse.redirect(
new URL(url.pathname.replace("/v2", ""), request.url)
)
}
}
export const config = {
matcher: "/api/:path*",
}