-
Notifications
You must be signed in to change notification settings - Fork 516
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
Project Happy Thoughts API #507
base: master
Are you sure you want to change the base?
Conversation
…ute with a response and console log text.
… the types and options.
…s file. Update with error handling.
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.
Great work 💪
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.
Remove unused code
const { message } = request.body; | ||
|
||
try { | ||
const newThought = await HappyThought.create({ message }); |
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.
Nice!
const updatedThought = await HappyThought.findByIdAndUpdate(thoughtId, | ||
{ $inc: { hearts: 1 } }, // Add 1 heart/like to the thought | ||
{ new: true } // Return the updated thought |
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.
⭐
View it live