feat(api): NestJS standalone 骨架 + Drizzle/postgres.js 接入

Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
浅念
2026-10-20 18:56:50 +08:00
parent 6725bf0024
commit 514f37301e
9 changed files with 1367 additions and 10 deletions
+12
View File
@@ -0,0 +1,12 @@
import { describe, it, expect } from 'vitest'
import { getDb } from '../src/db/client.js'
describe('数据库连接', () => {
it('连接本项目 PG(5434)并响应 select 1', async () => {
const db = getDb()
// postgres.js 驱动下 drizzle 的 execute 返回 RowList(行数组),
// 不是 node-postgres 风格的 { rows: [...] },故直接取 r[0]
const r = (await db.execute('select 1 as ok')) as any
expect(Number(r[0].ok)).toBe(1)
})
})