docs: refactored versioning in api reference + modified v2 content (#7274)
This commit is contained in:
18
www/apps/api-reference/middleware.ts
Normal file
18
www/apps/api-reference/middleware.ts
Normal 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*",
|
||||
}
|
||||
Reference in New Issue
Block a user