how to collect multiple fields using busboy nodejs
app.post('/somewhere', (req, res) => {
let formData = new Map();
req.busboy.on('field', function(fieldname, val) {
formData.set(fieldname, val);
});
req.busboy.on("finish", function() {
console.log(formData) // Map { 'name' => 'hi', 'number' => '4' }
// here you can do
formData.get('name') // 'hi'
formData.get('number') // '4'
// any other logic with formData here
res.end()
});
});