>>> npm i multer
const multer = require("multer")
const upload =multer({
dest: "imgs", //나중에 바이너리로 디비에 넣어줄 때 삭제
limits:{
fileSize: 100000
},
fileFilter(req, file, cb) {
if(file.originalname.match(/\.(jpg|jpeg|png)$/) {
return cb(new Error("plz upload images"))
}
cb(undefined, true)
}
})
app.post("/upload", upload.single("img"), (req, res) => {
res.send()
})