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

Added Feedback system to the Blog #18

Open
wants to merge 14 commits into
base: master
Choose a base branch
from

Conversation

anandbhardwaj1
Copy link

@anandbhardwaj1 anandbhardwaj1 commented Aug 9, 2020

Title and other contents always required.
Added Feedback Model which will help readers to go through the best content first i.e blogs are arranged according to their overall ratings.

Motivation

(Write your motivation here.)

Have you read the Contributing Guidelines on issues?

yes

Test Plan

i have tested on my local server.

Related PRs and Issues

#16
#12

title and content always required.
@parasg1999
Copy link

Could you please update the PR according to the template?

default rating is zero.
star rating system
update rating and sort the blog according to the feedback
added feedback button
@anandbhardwaj1 anandbhardwaj1 changed the title Update postStory.ejs Added Feedback system to the Blog Aug 17, 2020
console.log(errors);
if (!errors.isEmpty()) {

res.send(500);
Copy link
Member

@vaibhavrajsingh2001 vaibhavrajsingh2001 Aug 25, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Errors are sent with a message in this format:

return res.status(400).json({ msg: 'Empty request' });

// console.log(req.body.nodes[0].content);

}
else{

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use try and catch blocks for error handling btw. This helps in sending error responses for all sorts of errors, instead of sending individual response for particular errors.

@@ -105,6 +133,17 @@ router.post("/edit/:id", function (req, res) {
});
});


router.get("/posterror", function (req, res) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't write a separate route just for errors. Errors should be written for each individual route.

{upsert:false},

function(err, document){

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can write a simple console.log here cause otherwise there's no purpose of an error handling function.

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

Successfully merging this pull request may close these issues.

3 participants