我收到以下错误
错误 [ERR_HTTP_HEADERS_SENT]:在 ServerResponse.header (/Users/admin/Desktop/3100/a4/node_modules/express/lib/) 处的 ServerResponse.setHeader (_http_outgoing.js:526:11) 发送到客户端后无法设置标头response.js:771:10) 在 ServerResponse.json (/Users/admin/Desktop/3100/a4/node_modules/express/lib/response.js:264:10) 在 ServerResponse.send (/Users/admin/Desktop/ 3100/a4/node_modules/express/lib/response.js:158:21)在声明中。(/Users/admin/Desktop/3100/a4/app.js:95:17) --> 在 Database#all('SELECT * FROM users WHERE julianday(?) <= julianday(time) AND julianday(time) < = julianday(?);',[未定义,未定义],[功能])在/Users/admin/Desktop/3100/a4/app.js:90:12在Layer.handle [作为handle_request](/Users/admin /Desktop/3100/a4/node_modules/express/lib/router/layer.js:95:5)在下一个(/Users/admin/Desktop/3100/a4/node_modules/express/lib/router/route.js:137 :13)在jsonParser(/Users/admin/Desktop/3100/a4/node_modules/body-parser/lib/types/json.js:119:7)在Layer.handle [作为handle_request](/Users/admin/Desktop /3100/a4/node_modules/express/lib/router/layer.js:95:5)在下一个(/Users/admin/Desktop/3100/a4/node_modules/express/lib/router/route.js:137:13 )在Route.dispatch(/Users/admin/Desktop/3100/a4/node_modules/express/lib/router/route.js:112:3)在Layer.handle [作为handle_request](/Users/admin/Desktop/3100) /a4/node_modules/express/lib/router/layer.js:95:5) 在 /Users/admin/Desktop/3100/a4/node_modules/express/lib/router/index.js:281:22 在参数 (/用户/admin/Desktop/3100/a4/node_modules/express/lib/router/index.js:354:14)位于参数(/Users/admin/Desktop/3100/a4/node_modules/express/lib/router/index.js) js:365:14)在参数
**我想做的是发送数据。这就是我所做的:
db.all(
`SELECT * FROM users WHERE julianday(?) <= julianday(time) AND julianday(time) <= julianday(?);`, [add1.start,add1.end],function(err,rows){
if (!err){
console.log("Directly inside rows is: ",rows);
res.send(rows);
}
else{
res.send(err);
}
});
res.end();
**
手掌心
相关分类