import mysql from 'mysql2/promise'
export const pool = async(query,data)=>{

    let conn = 0;
    try{
        conn++;
        console.log("Connection",conn)
        const db = await mysql.createConnection({
            host: process.env.AUTH_HOST,
            user: process.env.AUTH_USER,
            password:process.env.AUTH_PASSWORD,
            database: process.env.AUTH_DATABASE,
          });
          const [result] = await db.execute(query,data);
            return result
          db.end();
    }
    catch(error){
        console.log(error)
    }
}