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 cache
public/world.json public/world.json
.dev.* .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` ## `NUXT_DISABLE_BOT_ACCESS_LOG`
Access statistics do not count bot traffic. 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': { '/dashboard': {
redirect: '/dashboard/links', redirect: '/dashboard/links',
}, },
'/api/**': {
cors: process.env.NUXT_API_CORS === 'true',
},
}, },
future: { future: {
@ -60,10 +63,6 @@ export default defineNuxtConfig({
enforceModuleCompatibility: true, enforceModuleCompatibility: true,
}, },
compatibilityDate: {
cloudflare: '2025-05-08',
},
nitro: { nitro: {
experimental: { experimental: {
openAPI: true, openAPI: true,