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.
20 lines
474 B
20 lines
474 B
const pool = require("../../server/db/connect");
|
|
|
|
type Data = {
|
|
row: string,
|
|
}
|
|
|
|
const queryString = "SELECT name, types FROM product_categories WHERE status=1";
|
|
|
|
export default function handler(
|
|
req: NextApiRequest,
|
|
res: NextApiResponse<Data>)
|
|
{
|
|
pool.query(
|
|
queryString,
|
|
(err: QueryError, rows: RowDataPacket[0]) => {
|
|
res.status(200).json(rows);
|
|
}
|
|
);
|
|
pool.removeAllListeners;
|
|
}; |