From 771777b6695e2ff14fdec04498aa676ec6491aa0 Mon Sep 17 00:00:00 2001 From: MoeFurina Date: Fri, 25 Jul 2025 17:07:48 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E5=B0=9D=E8=AF=95=E9=80=82=E9=85=8D?= =?UTF-8?q?=E6=9B=B4=E5=A4=9A=E5=B9=B3=E5=8F=B0=E7=9A=84=E9=83=A8=E7=BD=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- _routes.json | 20 ++++++++++++++++++++ edgeone.json | 14 ++++++++++++++ netlify.toml.json | 20 ++++++++++++++++++++ 3 files changed, 54 insertions(+) create mode 100644 _routes.json create mode 100644 edgeone.json create mode 100644 netlify.toml.json diff --git a/_routes.json b/_routes.json new file mode 100644 index 0000000..59ec587 --- /dev/null +++ b/_routes.json @@ -0,0 +1,20 @@ +{ + "version": 2, + "buildCommand": "npm install && npm run build", + "functions": { + "api/index.js": { + "runtime": "nodejs18.x" + } + }, + "routes": [ + { + "pattern": "/(.*)", + "script": "api/index.js", + "headers": { + "Access-Control-Allow-Credentials": "true", + "Access-Control-Allow-Methods": "GET, POST, PUT, DELETE, OPTIONS", + "Access-Control-Allow-Headers": "X-CSRF-Token, X-Requested-With, Accept, Accept-Version, Content-Length, Content-MD5, Content-Type, Date, X-Api-Version" + } + } + ] +} diff --git a/edgeone.json b/edgeone.json new file mode 100644 index 0000000..38b8826 --- /dev/null +++ b/edgeone.json @@ -0,0 +1,14 @@ +{ + "functions": [ + { + "path": "/(.*)", + "method": ["GET", "POST", "PUT", "DELETE", "OPTIONS"], + "handler": "index.js", + "headers": { + "Access-Control-Allow-Credentials": "true", + "Access-Control-Allow-Methods": "GET, POST, PUT, DELETE, OPTIONS", + "Access-Control-Allow-Headers": "X-CSRF-Token, X-Requested-With, Accept, Accept-Version, Content-Length, Content-MD5, Content-Type, Date, X-Api-Version" + } + } + ] +} diff --git a/netlify.toml.json b/netlify.toml.json new file mode 100644 index 0000000..97090f3 --- /dev/null +++ b/netlify.toml.json @@ -0,0 +1,20 @@ +{ + "functions": { + "api/index.js": { + "included_files": ["index.js"], + "runtime": "nodejs18.x" + } + }, + "redirects": [ + { + "source": "/(.*)", + "destination": "/api/index.js", + "headers": { + "Access-Control-Allow-Credentials": "true", + "Access-Control-Allow-Methods": "GET, POST, PUT, DELETE, OPTIONS", + "Access-Control-Allow-Headers": "X-CSRF-Token, X-Requested-With, Accept, Accept-Version, Content-Length, Content-MD5, Content-Type, Date, X-Api-Version" + }, + "status": 200 + } + ] +}