diff --git a/frontend/src/services/anecdotes.js b/frontend/src/services/anecdotes.js index a3a7c4c..395396f 100644 --- a/frontend/src/services/anecdotes.js +++ b/frontend/src/services/anecdotes.js @@ -1,6 +1,6 @@ import axios from 'axios'; -const baseUrl = 'http://localhost:3000/api/anecdotes'; +const baseUrl = '/api/anecdotes'; export async function getAll() { const response = await axios.get(baseUrl); diff --git a/frontend/vite.config.js b/frontend/vite.config.js index 58f1945..8bc49c8 100644 --- a/frontend/vite.config.js +++ b/frontend/vite.config.js @@ -4,6 +4,14 @@ import react from '@vitejs/plugin-react'; // https://vitejs.dev/config/ export default defineConfig({ plugins: [react()], + server: { + proxy: { + '/api': { + target: 'http://localhost:3000', + changeOrigin: true, + }, + }, + }, test: { environment: 'jsdom', globals: true,