简体   繁体   中英

Async Await in Cassandra using Node.js

I want to execute this query which I have written in cql by using Async Await functions.

client.execute('select * from users).then(res => {
    console.log('hello user');
}, err => {
    console.log(err);
});

Can someone tell me the exact translation of this query into Async Await functions.

I solved it but I am not deleting this post as it maybe can help somebody.

app.get('/', async(req,res) => {
    const res1 = await client.execute('select * from users);
    var user = res1.rows[0];
    console.log('successfull');
});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM