node_postgres/script.js
2020-11-27 01:01:42 -05:00

26 lines
525 B
JavaScript

const { Pool, Client } = require('pg')
/*
const pool = new Pool({
user: 'api',
host: '192.168.1.110',
database: 'ubm',
password: 'qqqx53!028',
port: 5433,
})
pool.query('SELECT NOW()', (err, res) => {
console.log(err, res)
pool.end()
})
*/
const client = new Client({
user: 'api',
host: '192.168.1.110',
database: 'ubm',
password: 'qqqx53!028',
port: 5433,
})
client.connect()
client.query('SELECT * from pg_stat_activity', (err, res) => {
console.log(err, res)
client.end()
})