Skip to content
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

Happy Thoughts API Project - Elina Eriksson Hult #505

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

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