【发布时间】:2018-10-01 00:02:25
【问题描述】:
我想从 mysql 中检索记录并在我的页面上显示以 nodejs 格式编码的数据
[
["1262889000000",788,803,783.3,795.65],
["1262889000000",788,813,783.3,795.65],
["1451500200000",2.85,13,1.05,1.1],
........
]
我的表架构
Column1 | col2 | col3 | col4 | col5
1262889000000 788 783.3 794 65
1262889000000 788 813.7 795 65
...........
...........
这是我的 nodejs 代码
app.get('/charts/sample1', function(req, res) {
con.query("select col1,col2,col3,col4,col5 from table1", function(err, data) {
res.send(data);
});
});
然而,目前当我运行我的代码时,我会在 json 中使用 {key1:value,key2:value,...},
【问题讨论】: