const pool = require("../../server/db/connect");

type Data = {
    row: string,
}

const queryString = "SELECT * FROM stock 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;
    };