API build for a social network web app where users can share their thoughts, react to friends' thoughts, and create a friend list. Uses Express.js, MongoDB, and the Mongoose ODM.
WHEN I open API GET routes in Insomnia for users and thoughts
THEN the data for each of these routes is displayed in a formatted JSON
WHEN I test API POST, PUT, and DELETE routes in Insomnia
THEN I am able to successfully create, update, and delete users and thoughts in my database
WHEN I test API POST and DELETE routes in Insomnia
THEN I am able to successfully create and delete reactions to thoughts and add and remove friends to a user’s friend list
API Routes
/api/users
[x] GET all users
[x] GET a single user by its _id and populated thought and friend data
[x] POST a new user:
// example data
{
"username": "lernantino",
"email": "lernantino@gmail.com"
}
[x] PUT to update a user by its _id
[x] DELETE to remove user by its _id
[x] BONUS: Remove a user's associated thoughts when deleted.
/api/users/:userId/friends/:friendId
[x] POST to add a new friend to a user's friend list
[x] DELETE to remove a friend from a user's friend list
/api/thoughts
[x] GET to get all thoughts
[x] GET to get a single thought by its _id
[x] POST to create a new thought (don't forget to push the created thought's _id to the associated user's thoughts array field)
// example data
{
"thoughtText": "Here's a cool thought...",
"username": "lernantino",
"userId": "5edff358a0fcb779aa7b118b"
}
[x] PUT to update a thought by its _id
[x] DELETE to remove a thought by its _id
/api/thoughts/:thoughtId/reactions
[x] POST to create a reaction stored in a single thought's reactions array field
[x] DELETE to pull and remove a reaction by the reaction's reactionId value
API Routes
/api/users
/api/users/:userId/friends/:friendId
/api/thoughts
/api/thoughts/:thoughtId/reactions