How can we parse JSON request data (POST Method) from Express? Here is a sample JSON request:
{
"username": "nodejs",
"password": "123"
}
How can we parse JSON request data (POST Method) from Express? Here is a sample JSON request:
{
"username": "nodejs",
"password": "123"
}
If you have body parser module, you can draw the requested variables in body
with req.body.~~
for example, like this:
funciton(res, req){
var username = req.body.username; //save the requested variable in username variable
return res.send(username);
}
the result would be:
nodejs