// Next.js API route support: https://nextjs.org/docs/api-routes/introduction
import { OkPacket, QueryError, RowDataPacket } from "mysql2";

const pool = require("../../server/db/connect");


const queryString = "SELECT products.id, products.title, description, type_pizza.img_trad, type_pizza.heft_trad FROM products, type_pizza WHERE products.status=1 and products.type='pizza' and type_pizza.id_products=products.id and type_pizza.size=40";

export default async function handler(
    req: NextApiRequest,
    res: NextApiResponse<Data>)
     {
   

            // execute in parallel, next console.log in 3 seconds
            await Promise.all([pool.query(queryString)]);
            console.log('3 seconds after');
            await pool.end();
    
    };