How do i retrieve a single field value from the "val" param with busboy?
.js
app.post('/somewhere', (req, res) => {
req.busboy.on('field', function(fieldname, val) {
//var foo = val.name;
//var bar = val.number;
});
});
.html
<input type="text" name="name"><br>
<input type="tel" name="number"><br>
According to busboy git:
field [...] Emitted for each new non-file field found.
Using the provided example, i was able to identify that 'var' consists of two strings:
typeof(val)
string
string
But after that i'm clueless in:
- What is val in this scope? A var? array? something else?
- How do i acess a specific element from val? Like the 'name' field.