text: import multer from 'multer';
  import { GridFsStorage } from 'multer-gridfs-storage';
  
  const storage = new GridFsStorage({
      url: `mongodb://localhost:27017/apnikahaani?readPreference=primary&appname=MongoDB%20Compass&directConnection=true&ssl=false`,
      // url: 'mongodb://localhost:27017/image-upload',
      options: { useUnifiedTopology: true, useNewUrlParser: true },
      file: (request, file) => {
          const match = ["image/png", "image/jpg"];
  
          if(match.indexOf(file.memeType) === -1) 
              return`${Date.now()}-blog-${file.originalname}`;
  
          return {
              bucketName: "photos",
              filename: `${Date.now()}-apnikahaani-${file.originalname}`
          }
      }
  });
  
  export default multer({storage}); 