Browse Source

flatten object

master
Rich Brown 1 year ago
parent
commit
26c1c0111a
1 changed files with 2 additions and 6 deletions
  1. +2
    -6
      routes/createRouter.js

+ 2
- 6
routes/createRouter.js View File

@@ -28,11 +28,6 @@ function sanitizeFile(file, cb) {

createRouter.post('/form', upload.single('file'), (req, res) => {
const { file, body: { title, body, arrayOfTags } } = req;
const image = {
filename: file.originalname,
buffer: file.buffer,
};
console.log(image);
return req.app.locals.mp
.create(
{
@@ -40,7 +35,8 @@ createRouter.post('/form', upload.single('file'), (req, res) => {
name: title, // i thought MF syntax was 'p-name' but voxpelli's formattr turns NAME to TITLE
content: body,
category: arrayOfTags,
photo: [image],
'photo.filename': file.originalname,
'photo.buffer': file.buffer,
},
'multipart',
)


Loading…
Cancel
Save