Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 275
Nikhil Avatar asked Feb 18 '26 10:02

Nikhil


1 Answers

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');
});
like image 143
Nikhil Avatar answered Feb 20 '26 03:02

Nikhil



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!