mirror of https://github.com/TZGyn/shortener
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
17 lines
351 B
TypeScript
17 lines
351 B
TypeScript
import { Database } from './types'
|
|
import { Pool } from 'pg'
|
|
import { Kysely, PostgresDialect } from 'kysely'
|
|
|
|
const dialect = new PostgresDialect({
|
|
pool: new Pool({
|
|
connectionString:
|
|
Bun.env.DATABASE_URL ??
|
|
'postgres://postgres:password@0.0.0.0:5432/link-shortener',
|
|
max: 10,
|
|
}),
|
|
})
|
|
|
|
export const db = new Kysely<Database>({
|
|
dialect,
|
|
})
|