import axios from 'axios'
const api = axios.create({
baseURL: '/api',
timeout: 30000,
headers: {'Accept': 'application/json', 'Content-Type': 'application/json;charset=utf-8'}
})
vite.config.js
server: {
open: true,
proxy: {
"/api": {
// target: "http://xxxxxxx.xyz:15000",
target: "http://127.0.0.1:15000",
changeOrigin: true,
rewrite: (path) => path.replace(/^\/api/, ''),
},
},
},