Files
burmddit/frontend/lib/db.ts
Min Zeya Phyo 98af1c7cec Adapt for self-hosted deployment on Coolify
- Replace @vercel/postgres with standard pg library
- Add Dockerfile for Next.js standalone build
- Add tsconfig.json, postcss.config.js
- Fix globals.css undefined tailwind utilities
- Force dynamic rendering for DB-dependent pages
- Add .dockerignore
2026-02-19 16:51:31 +08:00

17 lines
505 B
TypeScript

import { Pool } from 'pg'
const pool = new Pool({
connectionString: process.env.DATABASE_URL,
})
// Tagged template literal that mimics @vercel/postgres sql`` syntax
export async function sql(strings: TemplateStringsArray, ...values: any[]) {
// Build parameterized query: replace template expressions with $1, $2, etc.
let text = strings[0]
for (let i = 0; i < values.length; i++) {
text += `$${i + 1}` + strings[i + 1]
}
const result = await pool.query(text, values)
return result
}