-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
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:
// normal callback pattern
function getItem (id,callback) {
// some async call to db
if (err) {
callback(err,null);
} else {
callback(null,{id:5,name:'Bes'});
}
}// normal promise pattern
const Promise = require('bluebird');
function getItem (id) {
return new Promise(function (resolve, reject) {
// some async call to db
if (err) {
reject(err);
} else {
resolve({id:5,name:'Bes'});
}
});
}Hope that helps.
Metadata
Metadata
Assignees
Labels
No labels