-
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
W15-Project-Happy-Thoughts-API - Yia #481
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.
All looks good, just keep it up 🌻
.then(() => console.log("MongoDB connected successfully")) | ||
.catch((err) => console.error("MongoDB connection error:", err)); |
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.
👍
.sort({ createdAt: "desc" }) | ||
.limit(20) | ||
.exec(); | ||
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
}); | ||
|
||
app.post("/thoughts", async (req, res) => { | ||
console.log("Received data:", req.body); |
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 console.logs in production
} | ||
}); | ||
|
||
app.get("/thoughts/:id", async (req, res) => { |
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.
⭐
const updatedThought = await Thought.findByIdAndUpdate( | ||
req.params.id, | ||
{ $inc: { hearts: 1 } }, | ||
{ new: true } | ||
); |
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
Deploy link: https://project-happy-thoughts-api-044t.onrender.com
Happy thought link: https://yia-happy-thought.netlify.app/
Collaborators
Solo