In this lesson we’ll create an endpoint to delete an individual study group in the MongoDB database. The code for this lesson will be written and discussed in class.
Tasks
- Create
DELETE /studygroup/:id
endpoint - Test on localhost using Postman
Homework
- Add DELETE /studygroup/:id endpoint to your router.
- Add a functioning delete button next to each group that the user owns in the search results page.
- Create new endpoint: PATCH /studygroup/:id/participants?[add][remove] with user: userId in the body
- Allow:
- user to add self if studygroup is public
- user to remove self if studygroup is public or private
- Allow:
- Add functioning join button next to each studygroup that the user does not own and is not a member of in the search results page.
- Add a functioning leave button next to each studygroup that the user is a member of in the search results page.
- Modify GET /studygroups: add “member” to query string. When “member” is present in the query string, the endpoint returns only study groups that the user is a member of.
© 2024, Eric McGregor. All rights reserved. Unauthorized use, distribution and/or duplication of this material without express and written permission from the author is strictly prohibited.