Add 'packages/backend/' from commit 'acce648ee5e7e3a3006451e637c0db654820cc48'

git-subtree-dir: packages/backend
git-subtree-mainline: d0babd62af
git-subtree-split: acce648ee5
This commit is contained in:
Oliver Bryan
2025-12-13 20:21:47 +00:00
33 changed files with 1306 additions and 0 deletions

View File

@@ -0,0 +1,22 @@
import "dotenv/config";
import { drizzle } from "drizzle-orm/node-postgres";
if (!process.env.DATABASE_URL) {
throw new Error("DATABASE_URL is not set in environment variables");
}
export const db = drizzle({
connection: {
connectionString: process.env.DATABASE_URL,
},
});
export const testDB = async () => {
try {
await db.execute("SELECT 1;");
console.log("db connected");
} catch (err) {
console.log("db down");
process.exit();
}
};