-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcloudConfig.js
More file actions
28 lines (24 loc) · 903 Bytes
/
Copy pathcloudConfig.js
File metadata and controls
28 lines (24 loc) · 903 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
const cloudinary = require('cloudinary').v2;
const { CloudinaryStorage } = require('multer-storage-cloudinary');
cloudinary.config({ // while configuration we need cloud_name, api_key adn api_secret
cloud_name: process.env.CLOUD_NAME,
api_key: process.env.CLOUD_API_KEY,
api_secret: process.env.CLOUD_API_SECRET
});
// see documentation
const storage = new CloudinaryStorage({
cloudinary: cloudinary,
params: {
folder: 'WonderLand_DEV',
allowedFormats: ["png", "jpg", "jpeg"],
},
});
module.exports = {
cloudinary,
storage
}
// we created cloud web service and wrote credentials in .enc file then
// we created a configed our cloudinary through process.env
// then we created storage for uplaoding
// as multer requires direct storage so pas the storage in multer upload property
// upload.single will now upload each thing in the storage only