feat: Astro 开发模式 API 代理到本地 :3000
All checks were successful
Deploy Website / build-and-deploy (push) Successful in 8m54s

This commit is contained in:
wangdl 2026-06-27 12:55:02 +08:00
parent 697456c345
commit 16cce4152c

View File

@ -4,6 +4,7 @@ import tailwindcss from '@tailwindcss/vite';
const host = process.env.HOST || 'localhost'; const host = process.env.HOST || 'localhost';
const port = process.env.PORT || '4321'; const port = process.env.PORT || '4321';
const apiUrl = process.env.API_URL || 'http://127.0.0.1:3000';
export default defineConfig({ export default defineConfig({
site: process.env.SITE_URL || `http://${host}:${port}`, site: process.env.SITE_URL || `http://${host}:${port}`,
@ -15,5 +16,10 @@ export default defineConfig({
vite: { vite: {
plugins: [tailwindcss()], plugins: [tailwindcss()],
server: {
proxy: {
'/api': apiUrl,
},
},
}, },
}); });