I am parsing a simple form in a small node script (not using express or any framework) soo I create a function to parse the form body
function postForm(req, res) {
    let body = '';
    req.on('data', data => {
        body += data.toString();
    });
    req.on('end', () => {
        console.log(body);
    });
    res.write('ok');
    res.end();
}
but I do get all fields at once e.g. username=sam&age=22
I understand that in express I could just call body.username or body.age is there a trivial way to do the same ?
rant I can't believe how archaic is to parse a simple form element in nodejs. In go it would be 1 line(r.FormValue("name")) and so in php $_POST["name"]). I must be doing something wrong :)
 
     
     
    