I am trying to underset how the mssql npm package and queries work for node and when i do a console.log i don't understand the nested objects output
My query
bookRouter.route('/')
.get(function (req, res) {
var request = new sql.Request();
request.query('select * from books',
function(err, recordset){
console.log(recordset);
res.render('bookListView', {
title: 'Books',
nav: nav,
books: recordset //books
});
});
});
The console.log output
{ recordsets: [ [ [Object], [Object] ] ],
recordset:
[ { id: 1, title: 'node ', author: 'tom stickel' },
{ id: 2, title: 'angular', author: 'tom miller' } ],
output: {},
rowsAffected: [ 2 ] }
Why is there a the recordsets: object, object
and the 'recordset` ? I was watching a video doing the exact same thing and video shows console.log not having this . I'm more use to using web api of MS , with Angular...
But I want to switch to node for all api server and mssql db
via Jeremy Miller
No comments:
Post a Comment