From 3acc316576bfe9464f1b39dbde3b3359b6b14b65 Mon Sep 17 00:00:00 2001 From: heshunme Date: Sun, 30 Jun 2024 15:57:50 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=BA/api=E5=BC=80=E5=A4=B4=E7=9A=84axios?= =?UTF-8?q?=E8=AF=B7=E6=B1=82=E6=8F=90=E4=BE=9B=E7=9B=B4=E8=BE=BE8080?= =?UTF-8?q?=E7=AB=AF=E5=8F=A3=E5=90=8E=E7=AB=AF=E7=9A=84=E4=BB=A3=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vite.config.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/vite.config.js b/vite.config.js index 0c046a4..b6d9f43 100644 --- a/vite.config.js +++ b/vite.config.js @@ -16,5 +16,14 @@ export default defineConfig({ '@router': path.resolve(__dirname, 'src/router'), '@services': path.resolve(__dirname, 'src/services'), } + }, + server: { + proxy: { + '/api': { + target: 'http://localhost:8080', + changeOrigin: true, + rewrite: (path) => path.replace(/^\/api/, ''), + }, + }, } })