---
# System prepended metadata

title: '[Nuxt] Nuxt 3 - 跨域 CORS API'
tags: [Nuxt]

---

# [Nuxt] Nuxt 3 - 跨域 CORS API


###### tags: `Nuxt`


:::info
* [Nuxt Configuration - vite](https://nuxt.com/docs/api/configuration/nuxt-config#vite "Nuxt Configuration Reference · Nuxt")
* [Vite Server Options - proxy ](https://vitejs.dev/config/server-options.html#server-proxy "Server Options | Vite")
:::

```typescript
// nuxt.config.ts
export default defineNuxtConfig({
  vite: {
    server: {
      proxy: {
        '/VsWeb/api': { // API 路由
          target: 'https://www.vscinemas.com.tw/', // 主要 Domain
          changeOrigin: true,
        },
      },
    },
  },
});
```

```javascript
// .vue <script lang="ts" setup>
const { data: list } = await useFetch('/VsWeb/api/GetLstDicCinema');
```


---

:::info
建立日期：2023-08-28
更新日期：2023-09-08
:::