Skip to content

Project-api hand in#51

Open
RPaemurd wants to merge 11 commits intoTechnigo:masterfrom
RPaemurd:master
Open

Project-api hand in#51
RPaemurd wants to merge 11 commits intoTechnigo:masterfrom
RPaemurd:master

Conversation

@RPaemurd
Copy link
Copy Markdown

Copy link
Copy Markdown
Contributor

@HIPPIEKICK HIPPIEKICK left a comment

Choose a reason for hiding this comment

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

Some missing requirements:

  • Possibility to edit and delete in frontend
  • Thoughts are not saved (when refreshing the frontend, my newly created thought is gone)

@RPaemurd
Copy link
Copy Markdown
Author

RPaemurd commented Apr 1, 2026

@HIPPIEKICK The thoughts were saved but they were puplished at the and of the site, not at the beginning, so you probably just didnt see them. My bad. They are now at the top of the thoughts list.
changed
from: const thoughts = await Thought.find()

to: const thoughts = await Thought.find().sort({ createdAt: -1 })

I had the PUT and DELETE already in backend, lacked in frontend though. I will fix!

@RPaemurd
Copy link
Copy Markdown
Author

RPaemurd commented Apr 2, 2026

@HIPPIEKICK I think I have fixed everything, let me know if its not working :)

Copy link
Copy Markdown
Contributor

@HIPPIEKICK HIPPIEKICK left a comment

Choose a reason for hiding this comment

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

I will approve, but I'd check this in the frontend when you get time.

Screenshot 2026-04-07 at 10 30 10

@akiwumi
Copy link
Copy Markdown

akiwumi commented Apr 23, 2026

Nice work with the API and the frontend. I found a couple of things to look at

Single thought route has a typo

File: backend/routes/thoughts.js

In the route for GET /thoughts/:id, the code finds the thought and saves it in a variable called thoughts.

But later it tries to send back thoughtsId.

thoughtsId does not exist, so the route will crash when someone tries to get one thought by id.

You can fix it by sending back the variable that actually exists:

res.status(200).json(thoughts);

(I had some AI help on this)

Also, after sending a 404 response, it is good to add return so the function stops there.

  1. The project may not start from the root folder

File: server.js

The old root server.js was removed, and the backend code is now inside the backend folder.

That can be a problem because many people will try to run the project from the repo root with:

npm install
npm start

Right now that may fail, because the main package.json and server are inside backend.

One fix would be to keep the API setup in the root folder, or add root scripts that start the backend.

  1. Users must log in before seeing any thoughts

File: frontend/src/App.jsx

Right now, if there is no token, the app only shows the login form.

That means visitors cannot see the happy thoughts list, like thoughts, or visit the About page unless they log in first.

For this project, it would be better if everyone can see and like thoughts. Login can still be needed for posting, editing, and deleting.

The biggest things to fix are:

  • Fix the typo in the single thought route.
  • Make sure the project can start correctly from the expected folder.
  • Let visitors see the thoughts without logging in.
    .

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