Coder Social home page Coder Social logo

mock_9_server's Introduction

Social Media App

It is a backend for a Social Media app that allows users to post, like and comment on posts.

Dependencies

    "bcrypt": "^5.1.0",
    "cors": "^2.8.5",
    "dotenv": "^16.0.3",
    "express": "^4.18.2",
    "jsonwebtoken": "^9.0.0",
    "mongoose": "^7.1.0",
    "nodemon": "^2.0.22"

Models

  • User Model
  name: {type:String, required:true},
  email: {type:String, required:true},
  password: {type:String, required:true},
  dob: {type:Date, required:true},
  bio: {type:String, required:true},
  posts: [{ type: mongoose.Schema.Types.ObjectId, ref: 'Post' }],
  friends: [{ type: mongoose.Schema.Types.ObjectId, ref: 'User' }],
  friendRequests: [{ type: mongoose.Schema.Types.ObjectId, ref: 'User' }]
  • Post Model
    user: { type: mongoose.Schema.Types.ObjectId, ref: 'User' },
    text: String,
    image: String,
    createdAt: Date,
    likes: [{ type: mongoose.Schema.Types.ObjectId, ref: 'User' }],
    comments: [{
      user: { type: mongoose.Schema.Types.ObjectId, ref: 'User' },
      text: String,
      createdAt: Date
    }]

Routes

METHOD ENDPOINT DESCRIPTION STATUS CODE
POST /api/register This endpoint allow users to register. Hash the password on store. body: {name, email, password,dob,bio}. Date Should be in this formet dob:{2023-05-02T07:06:34.428Z} 201
GET /api/users This endpoint return a list of all registered users. 200
POST /api/users/:id/friends This endpoint allow the user to send a friend request to another user identified by its ID.body: {userId} 201
PATCH /api/users/:id/friends/:friendId This endpoint allow users to accept or reject friend requests sent to them by another user identified by its ID.body: {status:true or false} 204
GET /api/posts This endpoint return a list of all posts. 200
POST /api/posts This endpoint allow the user to create a new post.body: {user,text,image} 201
PATCH /api/posts/:id This endpoint allow users to update the text or image of a specific post identified by its ID. body: {text or image} 204
DELETE /api/posts/:id This endpoint allow users to delete a specific post identified by its ID. 202
GET /api/posts/:id This endpoint return the details of a specific post identified by its ID. 200

mock_9_server's People

Contributors

soumyaadhya007 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.