From 548ee242ba50a5e939566d13bb800b4d77145d28 Mon Sep 17 00:00:00 2001 From: xucheng Date: Thu, 8 Jan 2026 00:06:59 +0900 Subject: [PATCH] feat: Configure Next.js API proxy and update API base path to relative. --- frontend/next.config.ts | 9 ++++++++- frontend/src/lib/api.ts | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/frontend/next.config.ts b/frontend/next.config.ts index e9ffa30..fa6156f 100644 --- a/frontend/next.config.ts +++ b/frontend/next.config.ts @@ -1,7 +1,14 @@ import type { NextConfig } from "next"; const nextConfig: NextConfig = { - /* config options here */ + async rewrites() { + return [ + { + source: '/api/:path*', + destination: 'http://127.0.0.1:8000/api/:path*', + }, + ] + }, }; export default nextConfig; diff --git a/frontend/src/lib/api.ts b/frontend/src/lib/api.ts index d19afdd..2806917 100644 --- a/frontend/src/lib/api.ts +++ b/frontend/src/lib/api.ts @@ -1,4 +1,4 @@ -const API_BASE = "http://localhost:8000/api"; +const API_BASE = "/api"; export async function searchStock(query: string) { const res = await fetch(`${API_BASE}/search`, {