【发布时间】:2014-07-08 15:06:11
【问题描述】:
我有以下代码 -
sendServer.get('/download',function(request,response){
var status="SELECT * from poetserver.download where status='0'";
console.log(status)
connection.query(status,function(error,rows){
var toSend=rows[0].id
response.sendfile('./testimages/'+toSend+'.PNG')
// var details={"pictureId":toSend}
// response.writeHead(200, { 'Content-Type': 'application/json' });
// response.send(JSON.stringify(details));
本质上,首先,我想发送一个由 toSend 标识的文件。使用 response.sendFile 成功发送文件。但我也想为客户提供一些文件标识,以供将来回复。我也怎么发送?
【问题讨论】:
-
您应该将其包含在 url/uri 中。这就是他们的目的。
标签: javascript node.js express get response