a tool for shared writing and social publishing
1import { Pool } from "pg";
2import { attachDatabasePool } from "@vercel/functions";
3import { DbPool } from "@vercel/functions/db-connections";
4
5export const pool = new Pool({
6 idleTimeoutMillis: 5000,
7 min: 1,
8 max: 50,
9 connectionString: process.env.DB_URL,
10});
11
12// Attach the pool to ensure idle connections close before suspension
13attachDatabasePool(pool as DbPool);