diff --git a/frontend/src/lib/@api/index.ts b/frontend/src/lib/@api/index.ts index 9a16f8a..4c91982 100644 --- a/frontend/src/lib/@api/index.ts +++ b/frontend/src/lib/@api/index.ts @@ -2,7 +2,7 @@ import type { AxiosError } from 'axios'; export type Fetch = (input: RequestInfo, init?: RequestInit) => Promise; -export const API_URL = 'http://localhost:8000'; +export const API_URL = '/api'; export interface ApiError { error: AxiosError | unknown; diff --git a/frontend/vite.config.ts b/frontend/vite.config.ts index 1695034..1753371 100644 --- a/frontend/vite.config.ts +++ b/frontend/vite.config.ts @@ -2,7 +2,16 @@ import { sveltekit } from '@sveltejs/kit/vite'; import type { UserConfig } from 'vite'; const config: UserConfig = { - plugins: [sveltekit()] + plugins: [sveltekit()], + server: { + proxy: { + '/api': { + target: 'http://localhost:8000', + changeOrigin: true, + rewrite: (path) => path.replace(/^\/api/, '') + } + } + } }; export default config;