Skip to content

feat/sponsors-backend + frontend connection#39

Open
harrywu23 wants to merge 4 commits into
mainfrom
feat/sponsors-backend
Open

feat/sponsors-backend + frontend connection#39
harrywu23 wants to merge 4 commits into
mainfrom
feat/sponsors-backend

Conversation

@harrywu23
Copy link
Copy Markdown
Contributor

… should be good once its fixed.

Comment thread client/src/pages/Sponsors.tsx Outdated
}, []);

if (!sponsors) {
if (sponsors.length === 0) {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

length = 0 isn't preferable (if there's no sponsors then we're stuck in an infinite loading state!)

should use !sponsors like before (and usestate defaults to null like previously)

Comment thread client/src/pages/Sponsors.tsx Outdated

useEffect(() => {
Promise.resolve(sponsorsJsonData as SponsorsData)
fetch("http://localhost:3000/api/sponsors")
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

You should use axios for this, also consider adding a sponsorsApi.ts file to handle basic boilerplate (acts as a quick way to see/update the routes if the endpoint urls ever change)

@harrywu23 harrywu23 changed the title prompt generation of backend.... post and get giving error 404 but it… feat/sponsors-backend + frontend connection May 10, 2026
Copy link
Copy Markdown
Collaborator

@RLee64 RLee64 left a comment

Choose a reason for hiding this comment

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

Lgtm! Just two comments to address before you're able to merge in

@@ -0,0 +1,294 @@
import mongoose from "mongoose";
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Don't commit this file, once you've initialised the DB then you'll no longer need this. If you want to keep a data base template (for potential reversions), you should instead create a JSON/CSV file and save it to our shared drive. That said, doing this isn't necessary since we'll want to add a bulk input option at some point anyway.

res.json(sponsor);
});

router.get("/", async (req, res) => {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

make sure to lean() anything you end up returning

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