Initial web
This commit is contained in:
14
web/lib/db.ts
Normal file
14
web/lib/db.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
import { Pool } from 'pg';
|
||||
|
||||
declare global {
|
||||
// eslint-disable-next-line no-var
|
||||
var __pgPool: Pool | undefined;
|
||||
}
|
||||
|
||||
const pool = globalThis.__pgPool ?? new Pool({ connectionString: process.env.DATABASE_URL });
|
||||
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
globalThis.__pgPool = pool;
|
||||
}
|
||||
|
||||
export default pool;
|
||||
Reference in New Issue
Block a user