How do you extract POST data in node.js?

Answer

HTML:

<form method="post" action="/">
<input type="text" name="user[name]">
<input type="text" name="user[email]">
<input type="submit" value="Submit">
</form>


Javascript:

app.use(express.bodyParser());

app.post('/', function(request, response){

console.log(request.body.user.name);
console.log(request.body.user.email);

});

All node.js Questions

Ask your interview questions on node-js

Write Your comment or Questions if you want the answers on node-js from node-js Experts
Name* :
Email Id* :
Mob no* :
Question
Or
Comment* :
 





Disclimer: PCDS.CO.IN not responsible for any content, information, data or any feature of website. If you are using this website then its your own responsibility to understand the content of the website

--------- Tutorials ---