From aa8ebca8f63005a0b86d9c22f72b8cd157407f3e Mon Sep 17 00:00:00 2001 From: ccbikai Date: Sun, 20 Jul 2025 12:11:18 +0800 Subject: [PATCH] feat: add CORS support for API and update .gitignore and configuration documentation --- .gitignore | 1 + docs/configuration.md | 4 ++++ nuxt.config.ts | 7 +++---- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index e0338e5..a6ee4c2 100644 --- a/.gitignore +++ b/.gitignore @@ -27,3 +27,4 @@ site cache public/world.json .dev.* +.kiro/steering/locale.md diff --git a/docs/configuration.md b/docs/configuration.md index 2112df5..87e9e81 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -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. diff --git a/nuxt.config.ts b/nuxt.config.ts index d10682b..487e438 100644 --- a/nuxt.config.ts +++ b/nuxt.config.ts @@ -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,