精简cloudflare一键部署

This commit is contained in:
huangxd- committed 2025-09-13 10:17:44 +08:00
1 parent b1fddfcc30
commit 828a944aa8
2 files changed
+9 -23

No files matched your search

+4 -1
View File
@@ -15,5 +15,8 @@
"src": "/([^/]+)/api/(.*)",
"dest": "/danmu_api/worker.js"
}
]
],
"env": {
"TOKEN": "87654321"
}
}
+5 -22
View File
@@ -1,24 +1,7 @@
name = "danmu-api2" # Worker 名称,可自定义
main = "danmu_api/worker.js" # 入口文件路径(Workers 会导出 fetch 处理程序)
compatibility_date = "2025-09-13" # 使用当前日期或更高,确保兼容最新 API
name = "danmu-api2"
main = "worker.js"
compatibility_date = "2025-09-13"
# Node.js 兼容性标志(必需,用于 Express 和 process.env)
[compatibility_flags]
nodejs_compat = true
enable_nodejs_http_server_modules = true # 支持 node:http server API,用于 Express
# 构建步骤:安装依赖并构建(如果有 TypeScript 或其他构建需求)
[build]
command = "npm install" # 简单安装依赖;如果有构建脚本,可改为 "npm run build"
# 环境变量(文本类型,直接在代码中使用 process.env.TOKEN)
# 可选:默认环境变量(运行时可覆盖)
[vars]
NODE_ENV = "production" # 可选,默认值
# 触发器(可选,如果有定时任务)
[[triggers]]
crons = [] # 示例:["0 0 * * *"] 用于每日触发
# 环境(可选,用于不同环境如 dev/prod)
[env.production]
# 生产环境特定配置
TOKEN = "87654321"