Skip to content

Commit

Permalink
Fix examples at Data access section of the LAYERS page
Browse files Browse the repository at this point in the history
  • Loading branch information
KLarpen authored and tshemsedinov committed Dec 13, 2023
1 parent 0a5a393 commit 2f6dd69
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions content/en/LAYERS.md
Original file line number Diff line number Diff line change
Expand Up @@ -296,21 +296,21 @@ This will send HTTP GET request to `http://worldtimeapi.org/api/timezone/Europe/

## Data access

You can initialize database connection on application start from `application/db` for example putting `start` hook to `application/db/pg/start.js`:
You can initialize database connection on application start from `application/db` for example putting `start` hook to `application/db/geo/start.js`:

```js
async () => {
db.geo.pg = new Pool(config.database);
db.geo = new npm.pg.Pool(config.database);
};
```

After that you can access db driver from anywhere like:

```js
const res = await db.geo.pg.query('SELECT * from CITIES where ID = $1', [25]);
const res = await db.geo.query('SELECT * from CITIES where ID = $1', [25]);
console.log(res.rows[0]);
```

More examples in: [/content/en/DATA.md](/content/en/DATA.md)
More details with examples in: [/content/en/DATA.md](/content/en/DATA.md)

[👉 Back to contents](/) | [🚀 Getting started](/content/en/START.md) | [🗃️ Data modeling, storage, and access](/content/en/DATA.md) | [🧩 Application server features](/content/en/SERVER.md)

0 comments on commit 2f6dd69

Please sign in to comment.