Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Abstract your functions. #27

Open
FarahZaqout opened this issue Aug 15, 2018 · 0 comments
Open

Abstract your functions. #27

FarahZaqout opened this issue Aug 15, 2018 · 0 comments

Comments

@FarahZaqout
Copy link

dbConnection.query('SELECT posts.post_title, posts.post_body, users.name as posted_by, posts.date , posts.time FROM posts JOIN users ON users.user_id = posts.user_id ORDER BY posts.date desc;',
(err, result) => {
if (err) {
cb(err);
} else {
cb(null, result.rows);
}
});

Most of the lines in this code keep repeating in every query you write. The more lines you write the more likely you are to have bugs, the more difficult your code is to read, and the more time you take get the job done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant