我是Express的新手,现在我正尝试使用req.send()使后端为前端返回适当的sql数据数组sql,现在的问题是我可以得到我想要的结果作为结果部分显示,但是我只想要数字部分,我已经尝试了一些方法来获得它,但是失败了。.希望有人可以给我一些建议。
result part
{
"query": {
"offence": "robbery"
},
"result": [
{
"total": [
{
"sum(`robbery`)": 128
}
]
}
]
}
code part:
res.send({ "query": {
"offence": offence},
"result":[{
"total": a
}] },
);
```express
the offence is req.param, and a is a const of mysql sum query.
Expected:
{
"query": {
"offence": "robbery"
},
"result": [
{
"total": 128
]
}
]
}