// Загрузка списка пиццы
const pool = require("../../../server/db/connect");

const queryString = "SELECT type_pizza.id, type_pizza.title as name, type_pizza.heft_trad, type_pizza.type, type_pizza.heft_thin, type_pizza.price, type_pizza.img_thin, type_pizza.img_trad, type_pizza.size, products.title, products.description FROM type_pizza, products WHERE products.id=type_pizza.id_products and products.id=?";

export default function handler(req, res)  {
    //const data = req.body;
    const { pid } = req.query
    pool.getConnection(function(err, conn) {
        // Do something with the connection
        conn.query(queryString, [pid], function(err, rows, fields) {
            res.status(200).json(rows);
            console.log(rows);
         });
        // Don't forget to release the connection when finished!
        pool.releaseConnection(conn);
     })
}