This post is about how to catch and deal with parameter sent by post method from client.  First of all, you need to download and set up a middleware to achieve the goal.

The middleware's name is body-parser. You install body parser.

$ npm install body-parser --save

Then, set up in your app.js

// add middleware
app.use(bodyParser.json()); //suport json encoded bodies
app.use(bodyParser.urlencoded({extended:true}));//support encoded bodies

Then, play with it like one below. 

/*Ajax post*/'/postparams',function(req, res){
var receiver_acct = req.body.receiver_acct;
var memo = req.body.memo;
res.send(receiver_acct + " "+ memo);
module.exports = router;

This will work.

+ Recent posts