Node.js Develop WeChat Public Account Device Function Questions, Seek Answers! !

  node.js, question

Develop the equipment function items in Wechat Official Account, add hardware equipment to obtain the two-dimensional code, and a binding event will occur after scanning. When clicking on binding, official account on a social networking platform will send post request to the server and send a json data, but why can’t the server I created accept this json data? The following is the code for my server:

var express = require('express');
 var crypto = require('crypto');
 var xml = require('node-xml');
 var querystring = require('querystring');
 var xml2js = require('xml2js');
 var router = express.Router();
 //var parseString=require('xml2js').parseString;
 var token = "token";  //You need to modify it here!
 
 var parser = new xml2js.Parser();
 var http = require('http');
 var qs = require('querystring');
 /* GET home page. */
 router.get('/', function(req, res, next) {
 
 var signature = req.query.signature;
 console.log(signature);
 var timestamp = req.query.timestamp;
 var nonce = req.query.nonce;
 var echostr = req.query.echostr;
 
 /* The encryption/verification process is as follows: */
 //1. Sort the token, timestamp and nonce parameters by lexicographical order
 var array = new Array(token, timestamp, nonce);
 array.sort();
 var str = array.toString().replace(/,/g, "");
 //2. Splicing three parameter strings into a string for sha1 encryption
 var sha1Code = crypto.createHash("sha1");
 var code = sha1Code.update(str, 'utf-8').digest("hex");
 //3. The encrypted string obtained by the developer can be compared with signature to identify that the request originated from WeChat.
 if (code === signature) {
 res.send(echostr)
 
 } else {
 res.send("error");
 
 bracket
 });
 router.post('/', function(req, res) {
 // console.log('req is:' add req.toString ());
 var post_data = "";
 req.on("data", function(data) {
 Log ('jsonpost _ datais:' plus data.toString ());
 // parseString(data,function (err,result) {
 //   console.log(JSON.stringify(result));
 // });
 post_data = data;
 parser.parseString(data, function(err, result) {
 //Converts an object to a string output
 Log ('JSON data is:' plus JSON.stringify(result));
 console.log('fdfsfgdgfgrtg');
 });
 });
 res.send('thanks you for you message');
 
 req.on("end", function() {
 ///console.log ('jsonpost _ datais:' plus JSON.parse(post_data));
 var xmlStr = post_data.toString('utf-8', 0, post_data.length);
 Log ("accept moral message without xmlStr";
 });
 
 });
 //
 
 module.exports = router;
 Kneel to beg's answer really drives me crazy!  !

Post_data needs to be linked
Post_data plus = data in req.on;
So there it is, and then you parse it out.