I am new to node js. I know about event loop that node waits if there is any callbacks or events still pending. I have written a code to connect db and fetch data. The node doesn't exit even after the data is read.
var sql = require("mssql");
var config = {
user: 'data',
password: 'abc@123',
server: 'localhost',
database: 'master'
};
sql.connect(config, function (err) {
var request = new sql.Request();
var i;
request.query('GetData').then(
ri=>{
console.log(ri.recordset.map(o=>o.Key));
})
})
Can any one please help me why this is happening?