Saturday, 15 December 2018

Problem logging to the console with node.js

Today I open my tiny app I'm using to learn node.js with, together with express and sequelize but i suddenly encounter a problem, every time i want to log some object or array of objects or something like that (my app is tiny and also its objects) it takes really long and when the log comes it is monstrously long (of course that is syncronous so app freezes). It's like:exports.getCartPage = (req, res, next) => { req.user.getCart() .then(cart => cart.getProducts() .then(products => { console.log(products); //!!!!!!! res.render('shop/cart', { pageTitle: 'Cart', page: 'cart', products: products }); }) .catch(err => console.log('err'))) .catch(err => console.log('err')); } Any clue why this is suddenly happening, even trying to log a single product, could it be related to the relationships of the models? i cannot think of anything.

Submitted December 16, 2018 at 04:05AM by marcosdipaolo

No comments:

Post a Comment