feat: created getAllProducts feature
This commit is contained in:
1 parent
39fdf4c88d
commit
64fb1f7ac9
1 file changed
+12
@@ -59,4 +59,16 @@ export async function getProductById(productId: string) {
|
|||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function getAllProducts() {
|
||||||
|
try {
|
||||||
|
connectToDB();
|
||||||
|
|
||||||
|
const products = await Product.find();
|
||||||
|
|
||||||
|
return products
|
||||||
|
} catch (error) {
|
||||||
|
console.log(error);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user