var multer = require('multer')
var storage = multer.diskStorage({
destination: function (req, file, cb) {
cb(null, 'uploads/')
},
filename: function (req, file, cb) {
var fileFormat = (file.originalname).split(".");
cb(null, file.fieldname + '-' + Date.now() + "." + fileFormat[fileFormat.length - 1]);
}
})
var upload = multer({ storage: storage })
// const upload = multer({ dest: 'uploads/' });
router.use(upload.single('file'));
router.post('/',upload.single('file'),async(req,res)=>{
console.log(req.body);
console.log(req.file);
})