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.
19 lines
829 B
19 lines
829 B
// 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 function Handler() {
|
|
|
|
pool.getConnection(function(err, conn) {
|
|
// Do something with the connection
|
|
conn.query(queryString function(err, rows, fields) {
|
|
// Connection is automatically released when query resolves
|
|
});
|
|
// Don't forget to release the connection when finished!
|
|
pool.releaseConnection(conn);
|
|
})
|
|
} |