I'm working on a JS route handler. Basically, when a user click on a button it jumps to the next page with his information and the devices that he can check out.
router.get('/userManagement/:id', function(req,res){
var idNumber = req.params.id;
var registeredDevices = dbAPI.registeredDevices(true);
dbAPI.getInfoUser(idNumber).then(function(ret){
console.log(ret);
console.log(registeredDevices);
res.render('userManagement.njk', {obj: ret});
})
});
ret returns a JSON of the user information and console.log does show the JSON file correctly, but registeredDevices is displayed as Promise object. Why is that? How could I get the JSON from that function call?
Thanks