chore(dev): add /api proxy and docs
This commit is contained in:
+18
-1
@@ -1,5 +1,22 @@
|
||||
import type { NextConfig } from "next"
|
||||
|
||||
const nextConfig: NextConfig = {}
|
||||
const nextConfig: NextConfig = {
|
||||
async rewrites() {
|
||||
// 仅在开发环境启用 API 代理
|
||||
if (process.env.NODE_ENV !== "development") {
|
||||
return []
|
||||
}
|
||||
|
||||
const backendUrl =
|
||||
process.env.NEXT_PUBLIC_BACKEND_URL || "http://localhost:8080"
|
||||
|
||||
return [
|
||||
{
|
||||
source: "/api/:path*",
|
||||
destination: `${backendUrl}/api/:path*`,
|
||||
},
|
||||
]
|
||||
},
|
||||
}
|
||||
|
||||
export default nextConfig
|
||||
|
||||
Reference in New Issue
Block a user