You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Really like the db helpers, that's a nice way to decouple functionality and provide just an high level function to be used around the code while hiding implementation.
Noticed however that you use a callback pattern in some places and promises in others. In case you don't know how to create a promise pattern here is an example:
// normal callback patternfunctiongetItem(id,callback){// some async call to dbif(err){callback(err,null);}else{callback(null,{id:5,name:'Bes'});}}
// normal promise patternconstPromise=require('bluebird');functiongetItem(id){returnnewPromise(function(resolve,reject){// some async call to dbif(err){reject(err);}else{resolve({id:5,name:'Bes'});}});}
Hope that helps.
The text was updated successfully, but these errors were encountered:
Hi all!:)
Really like the db helpers, that's a nice way to decouple functionality and provide just an high level function to be used around the code while hiding implementation.
Noticed however that you use a callback pattern in some places and promises in others. In case you don't know how to create a promise pattern here is an example:
Hope that helps.
The text was updated successfully, but these errors were encountered: