Cargar archivos para expresar usando Express-FileUpload
const fileUpload = require('express-fileupload');
app.post('/upload', fileUpload, (req, res) => {
//Now you can use req.files.file to access the file input with name="file"
user.avatar = {data: req.files.file.data, contentType: req.files.file.mimetype};
//Now perform user.save
})
Khadidja Arezki