Commit Graph

9 Commits

Author SHA1 Message Date
golc 0a7d6c16c9 fix: 配置 Swagger UI 使用 CDN 资源
解决 Vercel serverless 环境中 SwaggerUIBundle 未定义的问题,
使用 jsDelivr CDN 加载 Swagger UI 静态资源。

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-04 11:41:01 +00:00
golc a7c082a162 fix: 修正 NestJS 构建产物路径为 dist/src
- 修复模块加载路径:dist/app.module -> dist/src/app.module
- 添加 Vercel 构建命令配置
- 确保 dist 目录在部署时被正确构建和包含

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-04 11:38:05 +00:00
golc 43ad64dd41 fix: 修复 Vercel serverless 模块路径解析问题
使用 path.resolve 动态解析 dist 目录路径,确保在 Vercel
serverless 环境中正确加载编译后的模块。

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-04 11:36:02 +00:00
lichao 914e156cc6 fix: 修复 Vercel 部署 404 和 Swagger 无法访问
- vercel.json: builds.src 从 package.json 改为 api/index.ts,routes.dest 从 /dist/api/index.js 改为 /api
- api/index.ts: 修正 require 路径,移除多余的 src/ 前缀
- api/index.ts: Swagger 挂载路径从 /api 改为 /docs,避免与 Vercel 函数路径冲突
- package.json: 添加 vercel-build 脚本确保部署前编译 NestJS
2026-03-04 19:30:07 +08:00
golc f557f8581b fix: 修复 Vercel serverless 运行时崩溃
关键修复:
- 使用 require() 而非 import() 动态加载编译后的模块
- 从 dist/src/ 路径加载模块(Vercel 构建后的路径)
- 移除 tsconfig 中对 api 目录的排除
- 配置 vercel.json 路由到 dist/api/index.js

技术说明:
- api/index.ts 会被编译到 dist/api/index.js
- 运行时从 dist/src/app.module 加载 NestJS 应用
- 使用 require 避免 TypeScript 编译时路径检查

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-04 11:14:09 +00:00
golc 6cb67ead1e fix: 配置 Vercel serverless 部署
核心修改:
- 添加 express 依赖
- 创建 api/index.ts 作为 Vercel serverless 入口
- 从 src/ 导入模块,TypeScript 编译到 dist/
- 排除 api/ 目录不被编译
- 简化 vercel.json 配置
- 更新 pnpm-lock.yaml
- 设置 Node.js 20.x

技术细节:
- Vercel 自动识别 api/ 目录为 serverless 函数
- api/index.ts 映射到 /api 路由
- 使用 ExpressAdapter 和缓存提升性能
- 配置 CORS、全局管道、Swagger 文档

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-04 09:58:09 +00:00
golc b91a17b071 merge: 合并 GitHub 远程更改并优化 serverless 配置
- 合并本地和远程的 api/index.ts 配置
- 使用 ExpressAdapter 提升 serverless 性能
- 保留全局过滤器和拦截器
- 保留 body-parser 大文件支持
- 统一 CORS 配置

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-04 09:20:54 +00:00
golc 1d8213f6ed feat: 配置 Vercel serverless 部署支持
- 更新 vercel.json 使用 serverless 函数入口
- 添加 api/index.ts 作为 Vercel serverless handler
- 添加 .env.vercel 环境变量配置模板
- 支持 Swagger 文档在 serverless 环境运行

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-04 09:19:00 +00:00
lichao 1de8bae73d feat: add Vercel serverless adapter for NestJS 2026-02-26 03:07:42 +00:00