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

Happy thoughts API - Emelie Nyberg #501

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

Conversation

EmelieNyberg
Copy link

}
});

const Thought = model('Thought', thoughtSchema);
Copy link
Contributor

Choose a reason for hiding this comment

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

Be consistent with double quotes

Comment on lines +71 to +92
// app.post("/thoughts", async (req, res) => {
// //Retrieve info that is sent by the user to our API endpoint
// // I use {} around message to make sure ONLY message can be sent in by the user, not hearts and createdAt.
// const { message } = req.body;

// try {
// // Use our mongoose model to create the database entry
// const thought = await new Thought({ message }).save();

// res.status(201).json({
// success: true,
// response: thought,
// message: "thought is created"
// });
// } catch (err) {
// res.status(400).json({
// success: false,
// response: err.errors,
// message: "Could not save thought to database"
// });
// }
// });
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove unused code


try {
// Find a thought with right ID and increase hearts by 1
const updatedThought = await Thought.findByIdAndUpdate(
Copy link
Contributor

Choose a reason for hiding this comment

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

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.

2 participants