diff --git a/controllers/products.js b/controllers/products.js index a30cb74..b768f70 100644 --- a/controllers/products.js +++ b/controllers/products.js @@ -59,10 +59,16 @@ module.exports = function (server) { //Show it in console for educational purposes... newProduct.whatAmI(); - - newProduct.save(); + /* The call back recieves to more arguments ->product/s that is/are added to the database + and number of rows that are affected because of save, which right now are ignored + only errors object is consumed*/ + newProduct.save(function(err) { + if(err) { + console.log('save error', err); + } res.redirect('/products'); + }); }); /**