Added backend folder in Bhakti's branch for Salvi to make changes.

This commit is contained in:
K
2025-02-23 09:15:03 +05:30
parent 7dd344f722
commit a551e075b7
28 changed files with 7028 additions and 0 deletions
+23
View File
@@ -0,0 +1,23 @@
const cloudinary = require("cloudinary").v2;
const fs = require("fs");
const uploadOnCloudinary = async (localFilePath) => {
try {
if (!localFilePath) return null;
const responce = await cloudinary.uploader.upload(localFilePath, {
resource_type: "auto",
});
// console.log("File is uploaded successfully");
fs.unlinkSync(localFilePath, () => {
console.log("file removed successfully");
});
return responce.url;
} catch (error) {
fs.unlinkSync(localFilePath);
console.log("file removed successfully");
return null;
}
};
module.exports = { uploadOnCloudinary };