This repository contains the implementation of a social network API built with MongoDB, Express.js, and Mongoose ODM. This API allows users to share their thoughts, react to friends' thoughts, and create a friend list, providing a backend foundation for a social network web application.
- User Management: Create, update, and delete users.
- Thought Management: Create, update, and delete thoughts posted by users.
- Reaction Management: Add and remove reactions to thoughts.
- Friend Management: Add and remove friends from a user's friend list.
- NoSQL Database: Uses MongoDB for handling large amounts of unstructured data efficiently.
-
Clone the Repository:
git clone https://github.com/andrewhamerly/social-network-api.git
-
Navigate to the project directory:
cd social-network-api -
Install dependencies:
npm install
-
Start the application:
npm start
-
Testing the API routes: Use Insomnia or a similar API client to test the following routes:
- GET
/api/usersGet all users. - POST
/api/usersCreate a new user. - PUT
/api/users/:userIdUpdate a user by ID. - DELETE
/api/users/:userIdDelete a user by ID. - POST
/api/users/:userId/friends/:friendIdAdd a friend to a user's friend list. - DELETE
/api/users/:userId/friends/:friendIdRemove a friend from a user's friend list.
- GET
/api/thoughtsGet all thoughts. - POST
/api/thoughtsCreate a new thought. - PUT
/api/thoughts/:thoughtIdUpdate a thought by ID. - DELETE
/api/thoughts/:thoughtIdDelete a thought by ID.
- POST
/api/thoughts/:thoughtId/reactionsAdd a reaction to a thought. - DELETE
/api/thoughts/:thoughtId/reactions/:reactionIdRemove a reaction from a thought.
- GET
Click here to watch the walkthrough video
- Express.js: For building the API routes and handling requests.
- MongoDB: A NoSQL database chosen for its flexibility and performance with large datasets.
- Mongoose: An ODM (Object Data Modeling) library for MongoDB and Node.js, used to define schemas and interact with the database.
- Insomnia: Used for testing the API endpoints.
This project is licensed under the MIT License. See the LICENSE file for details.
Contributions are welcome! Please fork the repository and create a pull request with your changes. For major changes, please open an issue first to discuss what you would like to change.
If you have any questions about the project, please feel free to contact me via email at [email protected]. You can also find more of my work on GitHub.