Browse Source

first step in file uploading; read what's received

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

+ 3
- 1
routes/createRouter.js View File

@@ -4,8 +4,9 @@ import express from 'express';
const createRouter = express.Router();

createRouter.post('/', (req, res) => {
const { text } = req.body;
const { text, file } = req.body;
let { tags, title } = req.body;
console.log(file);
if (!text || text === '' || typeof text !== 'string') {
return res.status(400).json({ error: 'Invalid or missing text.', url: null });
}
@@ -30,6 +31,7 @@ createRouter.post('/', (req, res) => {
name: title, // i thought MF syntax was 'p-name' but voxpelli's formattr turns NAME to TITLE
content: text,
category: tags,
photo: file,
},
'multipart',
)


Loading…
Cancel
Save