0
Well, first, I have two files: index.js that handles the requests and another that selects in the database, but I don’t know how to return it to the client.
app.get('/pesqAlimentos', (req, res) => {
pesqAlimentos(req.query.pesq.barraPesq);
});
The code above is from index.js.
function pesqAlimento(string){
let str = string.toLowerCase().
client.connect();
client.query("SELECT * FROM pesquisaAlimentos('?')", [str]).then(res =>
// aqui que não sei como retorno para o index as rows de
resposta para o index.js).catch(e => console.log(e))
}
This is the file where select is done. What I wanted is to be able to return res.Rows, or be able to send it as an answer already.