Files
blog.hareworks.net/src/lib/server/database/get_connection.ts
T
Hare 005fd864b2 feat: change article load logic
- change highlighter prism to shiki
- separate logic into several files
2024-09-07 02:42:50 +09:00

19 lines
433 B
TypeScript

import pg from 'pg';
const { Pool } = pg;
import {
PG_USER,
PG_PASS,
PG_HOST,
PG_PORT,
PG_DB,
} from '$env/static/private'
const connectionString = `postgres://${PG_USER}:${PG_PASS}@${PG_HOST}:${PG_PORT}/${PG_DB}`;
const pool = new Pool({ connectionString });
export const getConnection = () => pool;
import init_db from '$lib/server/database/init';
import PG from '$lib/server/database';
await init_db(await PG(pool));