-
Notifications
You must be signed in to change notification settings - Fork 517
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
base: master
Are you sure you want to change the base?
Conversation
} | ||
}); | ||
|
||
const Thought = model('Thought', thoughtSchema); |
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.
Be consistent with double quotes
// 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" | ||
// }); | ||
// } | ||
// }); |
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
|
||
try { | ||
// Find a thought with right ID and increase hearts by 1 | ||
const updatedThought = await Thought.findByIdAndUpdate( |
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.
⭐
Netlify link
https://happy-thoughts-project-technigo.netlify.app/
Render link
https://project-happy-thoughts-api-ek.onrender.com/