暫時沒找到問題的所在。app.post('/chart',function(req,res){varSQL='xxxxxxx';connection.query(SQL,function(err,rows){res.send(rows);})})如果這樣寫的話會報錯:Can'tsetheadersaftertheyaresent;如果是寫成:app.post('/chart',function(req,res){varSQL='xxxxxxxxxx';connection.query(SQL,function(err),rows){xxxxxxx};res.send({status:0});})這樣是不會報錯的。--前面的代碼都沒返回數(shù)據(jù)給前臺的。
異步處理導(dǎo)致的Can\'t set headers after they are sent??
梵蒂岡之花
2019-04-21 20:15:15