Попробуй таким образом
Сформируйте URL в этом файле localhost:portno/getData/:receiver_id/:sender_id
Ex: localhost:portno/getdata/12/21
app.get('/getData/:receiver_id/:sender_id',function(req,res){
connection.query('SELECT * FROM mytable WHERE sender_id=? AND receiver_id=?',[req.params.sender_id, req.params.receiver_id],function(error,results,fields){
if(error) throw error;
else {
res.json({'result':results})
console.log(JSON.stringify(results))
}
});
});
Другой способ
'Ex: localhost:portno/getdata/12&21`
app.get('/getData/:receiver_id&:sender_id',function(req,res){
connection.query('SELECT * FROM mytable WHERE sender_id=? AND receiver_id=?',[req.params.sender_id, req.params.receiver_id],function(error,results,fields){
if(error) throw error;
else {
res.json({'result':results})
console.log(JSON.stringify(results))
}
});
});
Еще один способ сделать это
app.get('/getData/:receiver_id&:sender_id',function(req,res){
connection.query('SELECT * FROM mytable WHERE sender_id=? AND receiver_id=?',req.params.sender_id, req.params.receiver_id,function(error,results,fields){
if(error) throw error;
else {
res.json({'result':results})
console.log(JSON.stringify(results))
}
});
});