text: import multer from 'multer'
  import path from 'path'
  import createError from 'http-errors'
  
  //init storage for image
  const storage = multer.diskStorage({
    destination: './public/uploads/',
    filename: function(req, file, cb){
      cb(null, file.fieldname + Date.now() + path.extname(file.originalname))
    }
  })
  
  //init multer
  const upload = multer({
    storage: storage,
    limits: {
      fileSize: 1024 * 1024 * 5
    },
    fileFilter: function(req, file, cb){
      if(file.mimetype === 'image/png' || file.mimetype === 'image/jpg'){
        cb(null, true)
      }else{
        cb(new createError(400, 'Please upload png or jpg format only.'), false)
      }
    }
  })
  export default upload;
  