# Uibuilder with PostgreSQL connection

**URL:** <https://discourse.nodered.org/t/uibuilder-with-postgresql-connection/59644>\
**Category:** General\
**Tags:** uibuilder\
**Created:** [10 March 2022 10:02 UTC](https://discourse.nodered.org/t/uibuilder-with-postgresql-connection/59644 "2022-03-10T10:02:14Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![endkinghenry](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/endkinghenry/32/58122_2.png) [@endkinghenry](https://discourse.nodered.org/u/endkinghenry)\
**Post date:** [10 March 2022 10:02 UTC](https://discourse.nodered.org/t/uibuilder-with-postgresql-connection/59644/1 "2022-03-10T10:02:14Z")

</div>

Dear sir, madam,

Is there a way to connect the uibuilder with the PostgreSQL database to call/ gather data, something similar to the code below here, without using the local flow connection (connecting the lines together)?

```auto
const { Client } = require('pg')
const client = new Client({
  user: 'sgpostgres',
  host: 'SG-PostgreNoSSL-14-pgsql-master.devservers.scalegrid.io',
  database: 'postgres',
  password: 'password',
  port: 5432,
})
client.connect(function(err) {
  if (err) throw err;
  console.log("Connected!");
});

```

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [10 March 2022 11:32 UTC](https://discourse.nodered.org/t/uibuilder-with-postgresql-connection/59644/2 "2022-03-10T11:32:27Z")

</div>

That is not advisable. your credentials would be discoverable in the client side code.

You should either generate an API (add node-red endpoints) and call them from your pages OR use the built in mechanisms uibuilder gives you for passing data to/from node-red

---

<div class="post-metadata">

**Author:** ![endkinghenry](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/endkinghenry/32/58122_2.png) [@endkinghenry](https://discourse.nodered.org/u/endkinghenry)\
**Post date:** [10 March 2022 15:01 UTC](https://discourse.nodered.org/t/uibuilder-with-postgresql-connection/59644/3 "2022-03-10T15:01:47Z")

</div>

alright, I see, thank you for your response/ answer.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [30 March 2022 08:26 UTC](https://discourse.nodered.org/t/uibuilder-with-postgresql-connection/59644/4 "2022-03-30T08:26:22Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
