Code Monkey home page Code Monkey logo

dotnet-social-api's Introduction

Social Media API

Welcome to the Social Media API! This API is built with .NET 8 and provides the backend services for a social media application. It supports a range of features to manage user profiles, interactions, and content.

Features

  • User Profiles: Create, update, and manage user profiles.
  • Follows: Follow and unfollow other users.
  • Likes: Like comments and posts.
  • Notifications: Receive notifications for various activities.
  • Posts: Create, view, update, and delete posts.
  • Direct Messages: Send and receive direct messages.

Getting Started

Prerequisites

  • .NET 8 SDK installed on your machine.
  • A SQL Server database or other supported database for persistence.

Installation

  1. Clone the repository:

    git clone https://github.com/yourusername/social-media-api.git
    
  2. Navigate to the project directory:

    cd social-media-api
    
  3. Restore the project dependencies::

    dotnet restore
    
  4. Update your appsettings.json file with your database connection string and any other configuration settings.

  5. Apply database migrations (if using Entity Framework) this will also seed some data to make it easier to test.

    dotnet ef database update
    
  6. Run the application:

    dotnet run

API Endpoints

User Profiles

  • Retrieve a User Profile

    • GET /api/users/{id}
    • Retrieves the user profile for the specified user ID.
  • Create a New User Profile

    • POST /api/users
    • Creates a new user profile.
  • Update a User Profile

    • PUT /api/users/{id}
    • Updates the user profile for the specified user ID.
  • Delete a User Profile

    • DELETE /api/users/{id}
    • Deletes the user profile for the specified user ID.

Follows

  • Follow a User

    • POST /api/follow/{userId}
    • Follows the user with the specified user ID.
  • Unfollow a User

    • DELETE /api/follow/{userId}
    • Unfollows the user with the specified user ID.

Likes

  • Like a Post

    • POST /api/posts/{postId}/like
    • Likes the post with the specified post ID.
  • Unlike a Post

    • DELETE /api/posts/{postId}/like
    • Unlikes the post with the specified post ID.
  • Like a Comment

    • POST /api/comments/{commentId}/like
    • Likes the comment with the specified comment ID.
  • Unlike a Comment

    • DELETE /api/comments/{commentId}/like
    • Unlikes the comment with the specified comment ID.

Notifications

  • Retrieve Notifications

    • GET /api/notifications
    • Retrieves notifications for the logged-in user.
  • Mark Notification as Read

    • PUT /api/notifications/{id}
    • Marks the notification with the specified ID as read.
  • Delete a Notification

    • DELETE /api/notifications/{id}
    • Deletes the notification with the specified ID.

Posts

  • Retrieve All Posts

    • GET /api/posts
    • Retrieves a list of all posts.
  • Retrieve a Specific Post

    • GET /api/posts/{id}
    • Retrieves the post with the specified post ID.
  • Create a New Post

    • POST /api/posts
    • Creates a new post.
  • Update a Post

    • PUT /api/posts/{id}
    • Updates the post with the specified post ID.
  • Delete a Post

    • DELETE /api/posts/{id}
    • Deletes the post with the specified post ID.

Direct Messages

  • Retrieve All Direct Messages

    • GET /api/messages
    • Retrieves all direct messages for the logged-in user.
  • Send a New Direct Message

    • POST /api/messages
    • Sends a new direct message.
  • Retrieve a Specific Message

    • GET /api/messages/{id}
    • Retrieves the direct message with the specified ID.
  • Delete a Direct Message

    • DELETE /api/messages/{id}
    • Deletes the direct message with the specified ID.

Authentication

The API uses JWT Bearer Tokens for authentication. Ensure you include a valid token in the Authorization header of your requests. The header should be formatted as follows: For more information on JWT Bearer Tokens, refer to the official documentation.

License

This project is licensed under the MIT License. See the LICENSE file for details. For more information about the MIT License, visit the MIT License website.

dotnet-social-api's People

Contributors

psk-98 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.