Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
igalklebanov authored Apr 6, 2024
1 parent 2e73f04 commit 23a9288
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,29 @@ Create a Kysely instance. Pass to it your `Database` type.
```ts
import {Kysely, PostgresDialect} from 'kysely'
import {Pool} from 'pg'
import type {Database} from './types/database'

export const kysely = new Kysely<Database>({
dialect: new PostgresDialect({
...
pool: new Pool({
connectionString: process.env.DATABASE_URL
})
})
})
```

or when using `postgres` instead of `pg` as the underlying driver:

```ts
import {Kysely} from 'kysely'
import {PostgresJSDialect} from 'kysely-postgres-js'
import postgres from 'postgres'
import type {Database} from './types/database'

export const kysely = new Kysely<Database>({
dialect: new PostgresJSDialect({
postgres: postgres(process.env.DATABASE_URL)
})
})
```
Expand Down

0 comments on commit 23a9288

Please sign in to comment.