Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
console.log('>> test')
const sqlOpen = toPromise(sql.open)
try {
console.log('sqlOpen ....')
const connection = await sqlOpen(connectionString)
console.log('..... sqlOpen')
const connectionQuery = toPromise(connection.queryRaw)
try {
const d = new Date()
console.log('connectionQuery 1 ....')
const data = await connectionQuery(query)
console.log('... connectionQuery 1')
const elapsed = new Date() - d
console.log(`rows.length ${data.rows.length} elapsed ${elapsed}`)
response.end(JSON.stringify(data, null, 4))
const close = toPromise(sql.close)
console.log('close ...')
await close()
console.log('... close')
console.log('<< test')
} catch (err) {
response.end(err.message)
}
} catch (err) {
response.end(err.message)
}
}