var storage = multer.diskStorage({
destination: function (req, file, cb) {
cb(null, './pubic/uploads')
},
filename: function (req, file, cb) {
cb(null, file.fieldname + '-' + Date.now())
}
})
var upload = multer({
storage: storage
});
router.post('/create', upload.single('cover'), (req, res) => {
console.log(req.file)
})