Update Web BaseAPI

This commit is contained in:
mizhexiaoxiao 2023-08-17 14:58:35 +08:00
parent c9b1e095a9
commit 665611aad7
3 changed files with 17 additions and 17 deletions

View File

@ -5,4 +5,4 @@ VITE_PUBLIC_PATH = '/'
VITE_USE_PROXY = true
# base api
VITE_BASE_API = '/api'
VITE_BASE_API = '/api/v1'

View File

@ -2,7 +2,7 @@
VITE_PUBLIC_PATH = '/'
# base api
VITE_BASE_API = '/api'
VITE_BASE_API = '/api/v1'
# 是否启用压缩
VITE_USE_COMPRESS = true

View File

@ -1,23 +1,23 @@
export const OUTPUT_DIR = 'dist'
export const PROXY_CONFIG = {
/**
* @desc 替换匹配值
* @请求路径 http://localhost:3100/api/user
* @转发路径 http://localhost:9999/api/v1 +/user
*/
'/api': {
target: 'http://localhost:9999/api/v1',
changeOrigin: true,
rewrite: (path) => path.replace(new RegExp('^/api'), ''),
},
// /**
// * @desc 替换匹配值
// * @请求路径 http://localhost:3100/api/v1/user
// * @转发路径 http://localhost:9999/api/v1/user
// * @desc 替换匹配值
// * @请求路径 http://localhost:3100/api/user
// * @转发路径 http://localhost:9999/api/v1 +/user
// */
// '/api/v1': {
// target: 'http://localhost:9999',
// '/api': {
// target: 'http://localhost:9999/api/v1',
// changeOrigin: true,
// rewrite: (path) => path.replace(new RegExp('^/api'), ''),
// },
/**
* @desc 不替换匹配值
* @请求路径 http://localhost:3100/api/v1/user
* @转发路径 http://localhost:9999/api/v1/user
*/
'/api/v1': {
target: 'http://localhost:9999',
changeOrigin: true,
},
}