folder restructure

This commit is contained in:
cv
2021-05-28 13:16:34 +02:00
parent 1491fbbb97
commit aa53f2c9cf
18 changed files with 17 additions and 71 deletions
+23
View File
@@ -0,0 +1,23 @@
import multer from 'multer';
const storage = multer.diskStorage({
destination: function (req, file, cb) {
cb(null, 'uploads/');
},
filename: function (req, file, cb) {
cb(null, Date.now() + '--' + file.originalname);
},
});
// filter only json
const filterJson = (req, file, cb) => {
if (file.mimetype.includes('application/json')) {
cb(null, true);
} else {
cb(null, false);
}
};
const uploadJson = multer({ storage: storage, fileFilter: filterJson });
export default uploadJson.single('jsondb');