feat: Configure Next.js API proxy and update API base path to relative.
This commit is contained in:
parent
a5a43e9db8
commit
548ee242ba
@ -1,7 +1,14 @@
|
|||||||
import type { NextConfig } from "next";
|
import type { NextConfig } from "next";
|
||||||
|
|
||||||
const nextConfig: NextConfig = {
|
const nextConfig: NextConfig = {
|
||||||
/* config options here */
|
async rewrites() {
|
||||||
|
return [
|
||||||
|
{
|
||||||
|
source: '/api/:path*',
|
||||||
|
destination: 'http://127.0.0.1:8000/api/:path*',
|
||||||
|
},
|
||||||
|
]
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
export default nextConfig;
|
export default nextConfig;
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
const API_BASE = "http://localhost:8000/api";
|
const API_BASE = "/api";
|
||||||
|
|
||||||
export async function searchStock(query: string) {
|
export async function searchStock(query: string) {
|
||||||
const res = await fetch(`${API_BASE}/search`, {
|
const res = await fetch(`${API_BASE}/search`, {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user