Matthias Hagemann
1 min readDec 5, 2018

--

You can use await only inside an async function, hence the async/await combination:

var myFunction = async () => {
var result = await pool.query(‘SELECT id, title FROM ann2 limit 10’)
}

Or write it inside a self-executing function:

(async () => {
var result = await pool.query(‘SELECT id, title FROM ann2 limit 10’)
})()

--

--

No responses yet