feat: created getAllProducts feature

This commit is contained in:
Leon Xu committed 2023-12-30 14:17:09 -08:00
1 parent 39fdf4c88d
commit 64fb1f7ac9
1 file changed
+12
+12
View File
@@ -59,4 +59,16 @@ export async function getProductById(productId: string) {
} catch (error) {
console.log(error);
}
}
export async function getAllProducts() {
try {
connectToDB();
const products = await Product.find();
return products
} catch (error) {
console.log(error);
}
}