79158107

Date: 2024-11-05 08:02:25
Score: 1
Natty:
Report link

did you initialize the client with the current parameters? make sure you upload only a specific code portion where the error occurs instead of copying and pasting the full code. try

const { Pool } = require('pg');

const pool = new Pool({
    user: process.env.DB_USER,
    host: process.env.DB_HOST,
    database: process.env.DB_NAME,
    password: process.env.DB_PASSWORD,
    port: process.env.DB_PORT || 5432
});

pool.connect((err, client, release) => {
    if (err) {
        console.error('Error connecting to the database:', err.stack);
    } else {
        console.log('Successfully connected to database');
    }
});

before registering a new user, try checking if it already exists and sanitize the inputs first.


Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Contains question mark (0.5):
  • Starts with a question (0.5): did you init
  • Low reputation (1):
Posted by: Muhammad Aamir Khan