MongoDB is a popular choice for many social networks due to its speed with large amounts of data and flexibility with unstructured data. The goal of this project is to build an API for a social network web application where users can share their thoughts, react to users' thoughts, and create a friend list.
This application utilizes Express.js for routing, a MongoDB database, and the Mongoose ODM.
Click on the following link to view a walkthrough video that highlights the usage of the application: NoSql Social Network API
Refer to the documentation in the MongoDB website for guidance on installing and setting up MongoDB.
Use the following steps to run the application locally:
- Clone this repository to your local machine. (For reference, visit the Cloning a Repository GitHub Docs article.)
- Run
npm i
in your CLI to download the npm package dependencies. - Optional: Run
npm run seed
to seed the database with the provided seed data. - Run
npm run start
to sync the Mongoose models to the MongoDB database and start the server.
This project requires the following npm package dependencies:
The animation gif below shows the responses for the User
API routes.
Supported API:
getUsers
: returns all the existing User documents in the collectiongetUserById
: returns a single User document by idcreateUser
: creates an instance of the User model using the data in req.bodyupdateUser
: updates an existing User with the req.bodydeleteUser
: deletes an existing User from the collection and deletes their associated ThoughtsaddFriend
: add a new friend to a user's friend listdeleteFriend
: remove a friend from a user's friend list
The animation gif below shows the responses for the Thought
API routes.
Supported API:
getThoughts
: returns all existing Thought documents in the collectiongetThoughtById
: returns a single Thought document by idcreateThought
: creates an instance of the Thought model using the data in req.bodyupdateThought
: updates an existing Thought with the req.bodydeleteThought
: deletes an existing Thought from the collectionaddReaction
: creates an instance of the Reaction schema to the associated ThoughtdeleteReaction
: deletes an existing reaction subdocument from the associated Thought
A testing suite was written with jest for the helper function format_date
. You may execute the test suite by running npm run test
on the CLI.
The API routes were tested locally during development with the Insomnia development platform.
Please refer to the Installation section if you are interested in running and testing the application locally.
To make contributions to this project:
- Fork the repository
- Make some commits to improve the application
- Open a Pull Request on GitHub
- From there, we can discuss your changes and merge the pull request once your contributions have been approved!
This GitHub repository is licensed under the MIT license. Please refer to the license documentation here.
This project was developed by dymoy.
For any related questions, please contact me via email at [email protected].