This social network API is a backend application using Node.js, Express, and MongoDB. It creates a database of users who can share thoughts, add friends, and react to other user's thoughts.
- To use this API you would need to clone the repository, and use it locally.
- Once you have the code locally, type "npm run start" to create a connection to the server. Use an API client to use the one of the following routes:
โ
GET
- http://localhost:3001/api/users
- Retrieves all users.
โ๏ธ POST
- http://localhost:3001/api/users
- Allows you to add a new user, using the following format for the request:
NOTE: Usernames will be converted to lowercase and all spaces will be removed.
โ
GET
- http://localhost:3001/api/users/:id
- Retrieves a single user, using the _id
property from the database.
โ๏ธ PUT
- http://localhost:3001/api/users/:id
- Updates a current user, using the following format for the request:
โ DELETE
- http://localhost:3001/api/users/:id
- Removes a user from the database.
NOTE: Removing a user will also remove any thoughts by that user.
โ๏ธ POST
- http://localhost:3001/api/users/:id/friends/:friendId
- Adds a friend to the selected user. No JSON is needed for this request. The user's id and the friend's id will be pulled from the url.
โ DELETE
- http://localhost:3001/api/users/:id/friends/:friendId
- Removes a friend from the user's list.
NOTE: Adding a friend to a user's list will NOT automatically add the user to the friend's list. Likewise, removing a friend from a user's list will NOT automatically remove the user from the friend's list.
โ
GET
- http://localhost:3001/api/thoughts
- Retrieves all thoughts.
โ๏ธ POST
- http://localhost:3001/api/thoughts
- Adds a new thought to the database, using the following format for the request:
NOTE: All thoughts and reactions are restricted to a 280 character maximum.
โ
GET
- http://localhost:3001/api/thoughts/:thoughtId
- Retrieves a single thought.
โ๏ธ PUT
- http://localhost:3001/api/thoughts/:thoughtId
- Updates a thought, using the following format for the request:
โ DELETE
- http://localhost:3001/api/thoughts/:thoughtId
- Removes a thought from the database.
โ๏ธ POST
- http://localhost:3001/api/thoughts/:thoughtId/reactions
- Adds a new reaction to the thought referenced in the url, using the following format:
โ DELETE
- http://localhost:3001/api/thoughts/thoughtId/reactions/:reactionId
- Removes a reaction from the thought referenced in the url.
Here is a link to the walkthrough video of the application.
- This application is licenced under the MIT License
- Contributions are welcome. Please create an independent branch and go through the customary and polite channels to initiate collaboration.
-
Checkout my personal portfolio to see my other projects!
-
Checkout my Github!
-
If you have questions, feel free to contact me at: [email protected]