Error conection postgres
Andrei Haba
0
Reputation points
I have a VM on Azure from which I'm trying to connect to a PostgreSQL database on Azure. The connection is not working, but if I use VS Code on Windows, the connection works. I have checked ufw, the firewall, and PostgreSQL. I have also installed PostgreSQL. Please tell me where to check. This
require('dotenv').config();
const { Client } = require("pg");
const {HOST, USER, PORT, PASSWORD, DATABASE} = process.env;
const client = new Client({
host:HOST, user:USER, port:PORT, password:PASSWORD, database:DATABASE
});
client.connect();
module.exports = {client};
//console.log(client);
//console.log(client.query, '999999999999999999999999')
//console.log({ host:HOST, user:USER, port:PORT, password:PASSWORD, database:DATABASE})
setInterval(()=>{
client.query('select * from preturi order by id limit 1', (err, data)=>{
if(err){
console.log(err, 'eroarea -----------------------------------')
}else{
console.log(data.rows, 'r ca au veni datele 5555555555555
Sign in to answer