You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/pages/index.mdx
+25-12Lines changed: 25 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,6 +3,8 @@ title: Welcome
3
3
slug: /
4
4
---
5
5
6
+
import { Logo } from'/components/logo.tsx'
7
+
6
8
node-postgres is a collection of node.js modules for interfacing with your PostgreSQL database. It has support for callbacks, promises, async/await, connection pooling, prepared statements, cursors, streaming results, C/C++ bindings, rich type parsing, and more! Just like PostgreSQL itself there are a lot of features: this documentation aims to get you up and running quickly and in the right direction. It also tries to provide guides for more advanced & edge-case topics allowing you to tap into the full power of PostgreSQL from node.js.
7
9
8
10
## Install
@@ -15,6 +17,21 @@ $ npm install pg
15
17
16
18
node-postgres continued development and support is made possible by the many [supporters](https://github.com/brianc/node-postgres/blob/master/SPONSORS.md).
17
19
20
+
Special thanks to [Medplum](https://www.medplum.com/) for sponsoring node-postgres for a whole year!
If you or your company would like to sponsor node-postgres stop by [GitHub Sponsors](https://github.com/sponsors/brianc) and sign up or feel free to [email me](mailto:brian@pecanware.com) if you want to add your logo to the documentation or discuss higher tiers of sponsorship!
19
36
20
37
# Version compatibility
@@ -54,21 +71,17 @@ try {
54
71
}
55
72
```
56
73
57
-
### Callbacks
74
+
### Pooling
58
75
59
-
If you prefer a callback-style approach to asynchronous programming, all async methods support an optional callback parameter as well:
76
+
In most applications you'll wannt to use a [connection pool](/features/pooling) to manage your connections. This is a more advanced topic, but here's a simple example of how to use it:
60
77
61
78
```js
62
-
import { Client } from'pg'
63
-
constclient=newClient()
64
-
65
-
client.connect((err) => {
66
-
client.query('SELECT $1::text as message', ['Hello world!'], (err, res) => {
0 commit comments