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.
26 lines
832 B
26 lines
832 B
// Next.js API route support: https://nextjs.org/docs/api-routes/introduction
|
|
import { OkPacket, RowDataPacket } from "mysql2";
|
|
import type { NextApiRequest, NextApiResponse } from 'next';
|
|
//import {BasicOrder, Order, OrderWithDetails} from "../../server/types/order";
|
|
import { db } from "../../server/db/connect";
|
|
|
|
type Data = {
|
|
out: string,
|
|
}
|
|
|
|
export default function handler(
|
|
req: NextApiRequest,
|
|
res: NextApiResponse<Data>)
|
|
{
|
|
const queryString = "SELECT * FROM products";
|
|
db.query(
|
|
queryString,
|
|
(err, result) => {
|
|
// if (err) {callback(err)};
|
|
// const insertId = (<OkPacket> result).insertId;
|
|
// callback(null, insertId);
|
|
console.log(result)
|
|
}
|
|
);
|
|
res.status(200).json({ out: 'dd' })
|
|
}; |