From 725c256791ae7e40e452dc0315a9324cd434af3f Mon Sep 17 00:00:00 2001 From: "santasri.pachhal" Date: Wed, 22 Jul 2026 17:07:05 +0530 Subject: [PATCH] refactor(api): simplify backend proxy to api and biz paths --- .env.example | 3 --- next.config.ts | 4 ++-- src/constants/secrect.constant.ts | 2 +- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/.env.example b/.env.example index 89b80bc..1707191 100644 --- a/.env.example +++ b/.env.example @@ -1,5 +1,2 @@ # Server-only backend origin. Do not expose this as a NEXT_PUBLIC variable. BACKEND_ORIGIN=http://localhost:8000 - -# Browser requests stay on the Next.js origin and are rewritten server-side. -NEXT_PUBLIC_API_URL=/backend/ diff --git a/next.config.ts b/next.config.ts index 9f56915..f5211df 100644 --- a/next.config.ts +++ b/next.config.ts @@ -11,8 +11,8 @@ const nextConfig: NextConfig = { async rewrites() { return [ { - source: '/backend/:path*', - destination: `${backendOrigin}/:path*`, + source: '/:namespace(api|biz)/:path*', + destination: `${backendOrigin}/:namespace/:path*`, }, ]; }, diff --git a/src/constants/secrect.constant.ts b/src/constants/secrect.constant.ts index 15f79c0..6003acc 100644 --- a/src/constants/secrect.constant.ts +++ b/src/constants/secrect.constant.ts @@ -1,3 +1,3 @@ export const ENV_CONSTANT = { - BASE_API_URL: process.env.NEXT_PUBLIC_API_URL, + BASE_API_URL: '/', };