fix(config): 更新API基础URL配置和开发环境代理设置
- 修改前端开发环境API基础URL添加/api路径前缀 - 调整web环境配置中API基础URL为相对路径 - 在后端Markdown控制器中添加测试接口的非生产环境限制 - 更新Vite代理配置注释说明路径重写功能
This commit is contained in:
@@ -11,6 +11,7 @@ import io.swagger.v3.oas.annotations.Parameter;
|
|||||||
import io.swagger.v3.oas.annotations.Parameters;
|
import io.swagger.v3.oas.annotations.Parameters;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.annotation.Profile;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
@@ -26,6 +27,7 @@ public class MarkdownController {
|
|||||||
|
|
||||||
@Operation(summary = "测试")
|
@Operation(summary = "测试")
|
||||||
@GetMapping("/test")
|
@GetMapping("/test")
|
||||||
|
@Profile("!prod")
|
||||||
public R<List<MarkdownFile>> test() {
|
public R<List<MarkdownFile>> test() {
|
||||||
List<MarkdownFile> test = markdownFileService.test();
|
List<MarkdownFile> test = markdownFileService.test();
|
||||||
return R.success(test);
|
return R.success(test);
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
VITE_API_BASE_URL=https://hdy16-16.311169.xyz
|
VITE_API_BASE_URL=https://hdy16-16.311169.xyz/api
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
VITE_BASE_URL=/
|
VITE_BASE_URL=/
|
||||||
VITE_API_BASE_URL=https://hdy16-16.311169.xyz
|
VITE_API_BASE_URL=/
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ export default defineConfig(({ mode }) => {
|
|||||||
'/api': {
|
'/api': {
|
||||||
target: 'http://127.0.0.1:8084',
|
target: 'http://127.0.0.1:8084',
|
||||||
changeOrigin: true,
|
changeOrigin: true,
|
||||||
rewrite: path => path.replace(/^\/api/, '')
|
rewrite: path => path.replace(/^\/api/, '') //去掉 api
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user