-
Notifications
You must be signed in to change notification settings - Fork 496
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 #479
base: master
Are you sure you want to change the base?
Conversation
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.
Good job, keep it up 🌻
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.
Good idea breaking this out 👍
app.get("/thoughts", async (req, res) => { | ||
try { | ||
const thoughts = await Thought.find().sort({ createdAt: -1 }).limit(20); | ||
res.json(thoughts); |
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.
A status code would be nice here
return res.status(404).json({ message: "Thought not found " }); | ||
} | ||
|
||
thought.hearts += 1; |
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.
This could also be done with $inc
Netlify link
Frontend: https://kaleidoscopic-gumption-4a304b.netlify.app/
Backend: https://project-happy-thoughts-api-cpw0.onrender.com/
Collaborators