-
Notifications
You must be signed in to change notification settings - Fork 5
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
base: master
Are you sure you want to change the base?
Conversation
title and content always required.
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
console.log(errors); | ||
if (!errors.isEmpty()) { | ||
|
||
res.send(500); |
There was a problem hiding this comment.
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{ |
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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){ | ||
|
There was a problem hiding this comment.
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.
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