There is a pattern being used in db.js, for example in queryAllUsers and queryUser, where an error is generated if no entries in the DB match the query. For example:
db.get('users').find(query)
.then((users) => {
if(users) {
resolve(users);
} else {
reject({message: 'error find all users', result: users});
}
})
.catch(reject);
Wouldn't it be more appropriate to just return an empty object/array instead of sending a reject, and keep reject only when there's an error? Like:
db.get('users').find(query)
.then(resolve)
.catch(reject);