You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
pizza.krasnikov.pro/.history/pages/api/loadingPizzaCard_2022053017...

23 lines
984 B

// Next.js API route support: https://nextjs.org/docs/api-routes/introduction
import { OkPacket, QueryError, RowDataPacket } from "mysql2";
import type { NextApiRequest, NextApiResponse } from 'next';
const pool = require("../../server/db/connect");
type Data = {
row: string,
}
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>)
{
async function example2 () {
const mysql = require('mysql2/promise');
// execute in parallel, next console.log in 3 seconds
await Promise.all([pool.query('select sleep(2)'), pool.query('select sleep(3)')]);
console.log('3 seconds after');
await pool.end();
}
};