feat: basic api setup and boilerplate
This commit is contained in:
15
backend/src/controllers/upload.controller.js
Normal file
15
backend/src/controllers/upload.controller.js
Normal file
@@ -0,0 +1,15 @@
|
||||
import multer from "multer";
|
||||
import path from "path";
|
||||
|
||||
const storage = multer.diskStorage({
|
||||
destination: function (req, file, cb) {
|
||||
cb(null, "uploads/blog");
|
||||
},
|
||||
|
||||
filename: function (req, file, cb) {
|
||||
const fileName = Date.now() + path.extname(file.originalname);
|
||||
cb(null, fileName);
|
||||
},
|
||||
});
|
||||
|
||||
export const upload = multer({storage});
|
||||
Reference in New Issue
Block a user