Доброе утро.Мне требуется фильтровать выход запроса sql на наличие совпадений.Спасибо большое.
app.post('/submit-messages',async (req,res) => {
const { category,message } = req.body
const creator = req.user
const tenders = new Promise(async(resolve,reject) => {
await pool.query('insert into messages set ?', { category,message,creator },async (error,results,fields) => {
if(error) console.log(error)
await pool.query(`select * from tenders where category = '${category}'`, (error,results,fields) => {
if(error) console.log(error)
resolve(results.map(r => r.creator))
})
})
})
tenders.then(r => console.log(r))
})
Answer: [ 18,18 ]