- Description
- Motivation
- Features
- Installation
- Usage
- API Endpoints
- Database Schema
- Error Handling
- Future Enhancements
- Contributors
- Questions
- License
This project is an API for a social network web application where users can share their thoughts, react to friends’ thoughts, and create a friend list. Built using Express.js for routing, a MongoDB database, and the Mongoose ODM, it serves as a robust backend for managing a social media platform.
The primary motivation behind building this application was to learn how to build associations between data in MongoDB and to provide a foundation for a full-fledged social media app. This project serves as a demonstration of proficiency in handling NoSQL databases and creating complex server-side applications.
- User account creation, update, and deletion.
- Posting, updating, and deleting thoughts.
- Adding and removing reactions to thoughts.
- Creating and managing a user's friend list.
- Real-time updates to user thoughts and reactions.
To install and run this project locally:
-
Clone the repository:
git clone https://github.com/kandekore/Social-Network-API.git
-
Navigate to the project directory:
cd Social-Network-API
-
Install dependencies:
npm install
-
Start the server:
npm start
For a detailed guide on how to use the application, please follow this link to the video demonstration.
- Create a User:
POST /api/users
- Post a Thought:
POST /api/thoughts
GET /api/users
: Get all usersPOST /api/users
: Create a new userGET /api/users/:userId
: Get a single userPUT /api/users/:userId
: Update a userDELETE /api/users/:userId
: Delete a userPOST /api/thoughts
: Create a new thoughtGET /api/thoughts
: Get all thoughtsGET /api/thoughts/:thoughtId
: Get a single thoughtPUT /api/thoughts/:thoughtId
: Update a thoughtDELETE /api/thoughts/:thoughtId
: Delete a thought
The database consists of three main models: User
, Thought
, and Reaction
. The User
model references the Thought
and Reaction
models to associate users with their thoughts and reactions.
- User: Stores user information and links to their thoughts and friend list.
- Thought: Represents a thought posted by a user, with fields for content, creation date, and associated reactions.
- Reaction: Captures users' reactions to thoughts.
A detailed schema visualization can be added here.
The API provides comprehensive error handling and input validation to ensure data integrity and provide meaningful error messages to the client.
- Integration with a front-end framework like React.
- Implementing real-time updates using WebSockets.
- Enhanced security features like OAuth for user authentication.
If you have any questions or suggestions, feel free to reach out:
- GitHub: kandekore
- Email: [email protected]
This project is licensed under the GNU GPL License. For more information, please refer to the LICENSE file in the repository.