Sto tentando di inviare un intero via response.send()
ma continuo a ricevere questo errorenodo-express errore: esprimere res.send deprecato (stato): Utilizzare res.sendStatus (stato) invece
esprimono res deprecate. inviare (stato): Utilizzare res.sendStatus (stato) invece
io non mando uno stato, il mio codice è
app.get('/runSyncTest' , function(request, response){
var nodes = request.query.nodes;
var edges = request.query.edges;
if (edges == ""){
edges = []
}
userStory.userStory(nodes,edges);
connection.query('SELECT MAX(id) as id FROM report ', function(err,results, fields) {
idTest = results[0].id
response.send (idTest)
});
});
solo per evitare di avvertimento, che ne dici di tornare JSON come 'response.send ({max: idTest})' 'Per quanto riguarda –
res.send()', [la fine manuale ] (http://expressjs.com/4x/api.html#res.send) afferma: _ "Il parametro body può essere un oggetto Buffer, una String, un oggetto o una matrice." _. Quindi gli interi non sono direttamente supportati e devono essere prima convertiti in uno di questi tipi. – robertklep
il trucco JSON ha funzionato grazie @HarisHasan –