Happy thoughts API - Emelie Nyberg#501
Open
EmelieNyberg wants to merge 4 commits intoTechnigo:masterfrom
Open
Conversation
HIPPIEKICK
approved these changes
Jan 7, 2025
| } | ||
| }); | ||
|
|
||
| const Thought = model('Thought', thoughtSchema); |
Contributor
There was a problem hiding this comment.
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" | ||
| // }); | ||
| // } | ||
| // }); |
|
|
||
| try { | ||
| // Find a thought with right ID and increase hearts by 1 | ||
| const updatedThought = await Thought.findByIdAndUpdate( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Netlify link
https://happy-thoughts-project-technigo.netlify.app/
Render link
https://project-happy-thoughts-api-ek.onrender.com/