-
Notifications
You must be signed in to change notification settings - Fork 496
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
technigo-w15-happy-thoughts-api #475
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good job Maja, I just added some small pointers for upcoming backend adventures 🚀
|
||
app.post("/thoughts", async (req, res) => { | ||
const { message } = req.body; | ||
const createdAt = new Date(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can have this as a default in your model
} | ||
}); | ||
|
||
app.get("/thoughts", async (req, res) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We usually put GET requests before POST requests
res.status(201).json(likedThought); | ||
} catch (error) { | ||
res.status(400).json({ | ||
success: false, | ||
response: error, | ||
message: "You were unable to like the thought", | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be nice if the JSON was structured the same in both blocks
Netlify link
Backend: https://technigo-w15-project-happy-thoughts-api.onrender.com/
Frontend: https://technigo-w7-project-happy-thoughts.netlify.app/
Collaborators
Solo