Skip to content

Conversation

ElinaEH
Copy link

@ElinaEH ElinaEH commented Dec 20, 2024

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 and a proper full stack one.

Keep it up!

Comment on lines +52 to +57
const endpoints = listEndpoints(app); // Automatically list all endpoints
res.json({
message: "Hello and welcome to the Happy Thoughts API! Here are all the available endpoints:",
endpoints: endpoints
});
});

Choose a reason for hiding this comment

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

neat and structured

app.get("/thoughts", async (req, res) => {
try {
const thoughts = await Thought.find()
.sort({ createdAt: -1 }) // Sort in descending order

Choose a reason for hiding this comment

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

.sort({ createdAt: "desc" })

this would be another way to do it

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.

2 participants