diff --git a/lib/actions/index.ts b/lib/actions/index.ts index 56a422d..3b1a06e 100644 --- a/lib/actions/index.ts +++ b/lib/actions/index.ts @@ -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); + } } \ No newline at end of file