Here is the code snippet I am currently working with:
console.log("-------------- Establishing connection to the database...");
const client = await pool.connect();
console.log("-------------- Connection successfully established.");
console.log("-------------- Executing query.");
var sql = `SELECT * FROM users WHERE email = '${email}'`;
console.log("-------------- Query executed successfully.");
let query = await client.query(sql);
client.release();
pool.release();
if(query.rows[0]){return "Email already exists. Please login."}
return 0;
I would like to achieve this using:
pool.getConnection
Can anyone guide me on how to accomplish it?