feat: add CORS support for API and update .gitignore and configuration documentation

This commit is contained in:
ccbikai 2025-07-20 12:11:18 +08:00
parent 225579ba68
commit aa8ebca8f6
3 changed files with 8 additions and 4 deletions

1
.gitignore vendored
View file

@ -27,3 +27,4 @@ site
cache
public/world.json
.dev.*
.kiro/steering/locale.md

View file

@ -61,3 +61,7 @@ Set the maximum query data volume for the Metric list.
## `NUXT_DISABLE_BOT_ACCESS_LOG`
Access statistics do not count bot traffic.
## `NUXT_API_CORS`
Set the environment variable `NUXT_API_CORS=true` during build to enable CORS support for the API.

View file

@ -50,6 +50,9 @@ export default defineNuxtConfig({
'/dashboard': {
redirect: '/dashboard/links',
},
'/api/**': {
cors: process.env.NUXT_API_CORS === 'true',
},
},
future: {
@ -60,10 +63,6 @@ export default defineNuxtConfig({
enforceModuleCompatibility: true,
},
compatibilityDate: {
cloudflare: '2025-05-08',
},
nitro: {
experimental: {
openAPI: true,