CORS set up
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
const API_URL = 'http://localhost:3002/api';
|
const API_URL = '/api';
|
||||||
|
|
||||||
export const getAuthToken = () => localStorage.getItem('token');
|
export const getAuthToken = () => localStorage.getItem('token');
|
||||||
export const setAuthToken = (token: string) => localStorage.setItem('token', token);
|
export const setAuthToken = (token: string) => localStorage.setItem('token', token);
|
||||||
|
|||||||
@@ -3,21 +3,28 @@ import { defineConfig, loadEnv } from 'vite';
|
|||||||
import react from '@vitejs/plugin-react';
|
import react from '@vitejs/plugin-react';
|
||||||
|
|
||||||
export default defineConfig(({ mode }) => {
|
export default defineConfig(({ mode }) => {
|
||||||
const env = loadEnv(mode, '.', '');
|
const env = loadEnv(mode, '.', '');
|
||||||
return {
|
return {
|
||||||
server: {
|
server: {
|
||||||
port: 3000,
|
port: 3000,
|
||||||
host: '0.0.0.0',
|
host: '0.0.0.0',
|
||||||
},
|
proxy: {
|
||||||
plugins: [react()],
|
'/api': {
|
||||||
define: {
|
target: 'http://127.0.0.1:3002',
|
||||||
'process.env.API_KEY': JSON.stringify(env.GEMINI_API_KEY),
|
changeOrigin: true,
|
||||||
'process.env.GEMINI_API_KEY': JSON.stringify(env.GEMINI_API_KEY)
|
secure: false,
|
||||||
},
|
|
||||||
resolve: {
|
|
||||||
alias: {
|
|
||||||
'@': path.resolve(__dirname, '.'),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
},
|
||||||
|
plugins: [react()],
|
||||||
|
define: {
|
||||||
|
'process.env.API_KEY': JSON.stringify(env.GEMINI_API_KEY),
|
||||||
|
'process.env.GEMINI_API_KEY': JSON.stringify(env.GEMINI_API_KEY)
|
||||||
|
},
|
||||||
|
resolve: {
|
||||||
|
alias: {
|
||||||
|
'@': path.resolve(__dirname, '.'),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user