Skip to content

Commit

Permalink
add upload picture feature
Browse files Browse the repository at this point in the history
  • Loading branch information
Ghalia98 committed Feb 14, 2022
1 parent f995f45 commit 973aac0
Show file tree
Hide file tree
Showing 6 changed files with 1,536 additions and 26 deletions.
22 changes: 22 additions & 0 deletions config/cloudinary.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
const cloudinary = require('cloudinary').v2
const { cloudinaryStorage } = require('multer-storage-cloudinary')
const multer = require('multer')
const { CloudinaryStorage } = require('multer-storage-cloudinary')

cloudinary.config({
cloud_name: process.env.CLOUDINARY_NAME,
api_key: process.env.CLOUDINARY_KEY,
api_secret: process.env.CLOUDINARY_SECRET,
})

const storage = new CloudinaryStorage({
cloudinary: cloudinary,
params: {
folder: 'recipe-app',
allowed_formats: 'jpg, png'
}
})

const uploader = multer({ storage })

module.exports = uploader
Loading

0 comments on commit 973aac0

Please sign in to comment.