Делаю пример по подключению к БД
const {Client} = require('pg');
const db = new Client({
user:'postgres',
host:'localhost',
password:'12345',
port:5432
})
db.connect()
db.query('SELECT * FROM students',(err, data) =>{
console.log(err, data);
db.end()
})
Получаю кучу ошибок, что я делаю не так, подскажите
(node:14944) UnhandledPromiseRejectionWarning: error: ���� ������ "*******" �� ����������
at Connection.parseE (D:\nodejs\node_modules\pg\lib\connection.js:555:11)
at Connection.parseMessage (D:\nodejs\node_modules\pg\lib\connection.js:380:19)
at Socket. (D:\nodejs\node_modules\pg\lib\connection.js:120:22)
at Socket.emit (events.js:182:13)
at addChunk (_stream_readable.js:283:12)
at readableAddChunk (_stream_readable.js:264:11)
at Socket.Readable.push (_stream_readable.js:219:10)
at TCP.onStreamRead [as onread] (internal/stream_base_commons.js:94:17)
(node:14944) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which
was not handled with .catch(). (rejection id: 1)
(node:14944) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
D:\nodejs\01-connect.js:13
if (err) throw new Error(err)