Untitled

mail@pastecode.io avatar
unknown
plain_text
a month ago
418 B
2
Indexable
Never
const connection = require('./connections');

const getAllProductsDataBase = async () => {
  const [products] = await connection.execute('SELECT * FROM products ORDER BY id ASC');
  return products;
};

const getProductsById = async (id) => {
  const [product] = await connection.execute('SELECT * FROM products WHERE id = ?', [id]);
  return product;
};

module.exports = { getAllProductsDataBase, getProductsById }; 
Leave a Comment