Skip to content

Conversation

tildetilde
Copy link

Copy link

@simfrisk simfrisk left a comment

Choose a reason for hiding this comment

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

Hi Tilde! As always great work! I tried to find stuff to improve on but you make that hard with you great work. I think you had a good structure, good naming and clean code. Makes it easy to follow along. Especially loved the routes that you split up. The only thing I found that could be approved upon is that you could make the const in your routs their own files so that the file does not get to large. But maybe that is just my preference.

But once again, super great work as always. Really look forward to see your and Idas final project!

Choose a reason for hiding this comment

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

Nice to do list! I need to start getting more organised like this even when working solo!

}
};

// PATCH /thoughts/:id/like

Choose a reason for hiding this comment

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

Great comments so that it is easy to look up!

// PATCH /thoughts/:id/like
export const likeThought = async (req, res) => {
try {
const updated = await Thought.findByIdAndUpdate(

Choose a reason for hiding this comment

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

I am wondering myself. Is update a good name? At first a thought no but then when I thought about it that it is in a function maybe it is overkill to have like updateThought or whatever. So I think it is a good name!

{ $inc: { hearts: 1 } },
{ new: true }
);
if (!updated) return res.status(404).json({ message: "Thought not found" });

Choose a reason for hiding this comment

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

Nice error handling! Like all the rest you did!

Choose a reason for hiding this comment

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

Looks great! Only thing that could be nice is to add the different consts into a different util component to make it easier to find the right one. Sort of like you did in your routes file.

// DELETE /thoughts/:id – Delete a thought
router.delete("/:id", authenticateUser, deleteThought);

export default router;

Choose a reason for hiding this comment

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

Do you like export default more? I prefer the export const. Nothing wrong just different ways of doing it

Choose a reason for hiding this comment

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

Good error handeling and clear messages


app.use("/thoughts", thoughtsRoutes);

app.use("/users", usersRoutes);

Choose a reason for hiding this comment

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

I like once again that you broke out your routes for a cleaner code

import fs from "fs";

const loadThoughts = () => {
const data = fs.readFileSync("data/data.json");

Choose a reason for hiding this comment

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

What is: fs.readFileSync


const mongoUrl = mongoose
.connect(mongoUrl, { useNewUrlParser: true, useUnifiedTopology: true })
.then(() => console.log("🟢 Connected to MongoDB"))

Choose a reason for hiding this comment

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

Love the emojis for a clearer message

Copy link

@JennieDalgren JennieDalgren left a comment

Choose a reason for hiding this comment

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

Great job with this project.

loadThoughts and seedThoughts? what was the idea with both of them? I guess you only want to seed the db once with that json and then use the data from your db?

Well structured project, clear separation and consistent formattin, naming etc.

When trying to register it seems to be stuck?
image

Can you take a look and ping me when it's working so I can continue with the review?

@@ -0,0 +1,53 @@
# ✅ TODO: Connect Frontend & Backend for Happy Thoughts

Choose a reason for hiding this comment

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

⭐ Great way to organise your work.

@tildetilde
Copy link
Author

tildetilde commented Sep 3, 2025 via email

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.

3 participants