Skip to content

Commit ddcaf32

Browse files
author
Mohamed Nainar
authored
use top-level await (#98)
1 parent b1b9aa0 commit ddcaf32

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

content/welcome.mdx

+4-7
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,11 @@ This is the simplest possible way to connect, query, and disconnect with async/a
3737
```js
3838
const { Client } = require('pg')
3939
const client = new Client()
40+
await client.connect()
4041

41-
;(async () => {
42-
await client.connect()
43-
44-
const res = await client.query('SELECT $1::text as message', ['Hello world!'])
45-
console.log(res.rows[0].message) // Hello world!
46-
await client.end()
47-
})()
42+
const res = await client.query('SELECT $1::text as message', ['Hello world!'])
43+
console.log(res.rows[0].message) // Hello world!
44+
await client.end()
4845
```
4946

5047
And here's the same thing with callbacks:

0 commit comments

Comments
 (0)