Skip to content

a GraphQL api for for creating and sharing videos

License

Notifications You must be signed in to change notification settings

khalidM3/GraphTube

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GraphTube

GraphTube is a api built on GraphQL, Node, express and Mongoose, that lets you post videos, like and dislike them, follow other user and much more.

Getting started

Environment

  • This api uses a Mongodb database, so you will need one in order to use it.

Installing

Download

First clone the repository

$ git clone https://github.com/khalidM3/GraphTube.git
Set up

Install the dependencies and devDependencies and start the server.

$ yarn install

create a .env file and add the following properties

MONGODB_URI='<MONGODB URI>'
start the server
$ node start

Now you can make requests to localhost:4000

API reference

Models

There are two models in this api

  1. User
  2. Video

Types

There are Four graphQL types in this api

  1. User
  2. UserInput
  3. Video
  4. VideoInput

Queries

There are nine queries in total inluding :

  1. fetchAllUsers

    • this query gets all the users in the database
    • type: User
  2. fetchUser(id: ID!)

    • this query gets a specified user
    • type: User
    • arguments:
      1. id : id of the user that is being fetched
  3. fetchFollowers(id: ID!)

    • this query gets a users followers
    • type: User
    • arguments:
      1. id : id of the user
  4. fetchFollowing(id: ID!)

    • This query fetches a users following
    • type: User
    • arguments:
      1. id : id of the user
  5. fetchVideo(id: ID!)

    • This query fetches a video by its id
    • type: Video
    • arguments:
      1. id : id of the video to fetch
  6. fetchAllVideo

    • This query fetches all the users in the db
    • type: Video
  7. fetchMyVideos(id: ID!)

    • This query fetches all the videos a user posted
    • type: Video
    • arguments:
      1. id : id of the user making the request
  8. fetchWatchLater: [Video]

    • This query fetches all the videos a saved for later
    • type: Video
    • arguments:
      1. id : id of the user making request
  9. fetchWatchHistory: [Video]

    • This query fetches all the videos the user watched
    • type: Video
    • arguments:
      1. id : id of the user making the request

Mutations

There are 12 mutations in this app

  1. userAdd(data: UserInput!)

    • type: User
    • arguments
      1. data
  2. userFollow(id: ID!uid: String!)

    • type: User
    • arguments:
      1. id : id of the user that is being followed
      2. uid: id of the user that is following
  3. userUpdate(id: ID!data: UserInput!)

    • type: User
    • arguments:
      1. id : id of the user being updated
      2. data : the updated user
  4. userDelete(id: ID!)

    • type: User
    • arguments:
      1. id: id of the user being deleted
  5. addToWatchLater(id: ID!uid: String!)

    • type: User
    • arguments:
      1. id: id of the video to added to watch later
      2. uid: id of the user who wants to watch later
  6. addToWatchHistory(id: ID!uid: String!)

    • type: User
    • arguments:
      1. id : id of the video to added to watch history
      2. uid: the id of user of the history the video is being added to
  7. clearWatchHistory(id: ID!uid: String!)

    • type: User
    • arguments:
      1. uid : the id of the user whos history is being cleared
  8. addVideo(data: VideoInput!)

    • type: video
    • arguments:
      1. data : the data of the video
  9. likeVideo(id: ID! user: String!)

    • type: video
    • arguments:
      1. id : the id of the video to liked
      2. user : the id of the user making the request
  10. dislikeVideo(id: ID!user: String!)

    • type: video
    • arguments:
      1. id : the id of the video to disliked
      2. user : the id of the user making the request
  11. updateVideo(id: ID!user: String!data: VideoInput!)

    • type: video
    • arguments:
      1. id : the id of the video to update
      2. user: the id of the user making the request
      3. data : the updated video
  12. deleteVideo(id: ID!uid: String!)

    • type: video
    • arguments:
      1. id : the id of the video to delete
      2. uid : the id of the user making the request

Releases

No releases published

Packages

No packages published