Hi I am trying to run a post request using connect-busboy but not able to do so. additionally I am not able to pinpoint the error as it is not showing any error.
Additionally I am using postman to check the router with the below settings : x-www-form-urlencoded
If someone can please help me resolve this issue.
Please let me know if you require any further information from my end.
Please find below the necessary code :
user profile.js
router.post('/userprofile/check/busboy', async (req,res) => {
console.log(req.body);
// const busboy = Busboy({headers: req.headers});
const fields = {};
req.busboy.on('field', (fieldname, val) => {
console.log('reached till here');
if(fieldname === 'userId') {
console.log(`Processed field ${fieldname}: ${val}.`);
}
fields.set(fieldname,val)
fields[fieldname] = val;
});
req.busboy.on('finish', function() {
console.log('Done parsing form!');
});
app.js
var busboy = require('connect-busboy');
app.use(busboy());