'postgresql is not connecting to my nodejs server

all was going smooth but after some day i check it not connecting to my backend postgre database, i have database mention in connection but still i am not getting data

const { Pool, Client } = require('pg');
var fs = require('fs');
const app = require("express").Router();

const connection = new Client({
  user: "postgres",
  host: "localhost",
  database: "mypassword",
  password: "database1",
  port: 5432,
});
connection.connect(err => {
  if (err) {
    console.error('connection errorssss', err.stack)
  } else {
    console.log('connectedsssssss')
  }
})

IT DOEENT SHOW ME ANY ERROR OR SUCCESS MESSAGE PLEASE HELP



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source