- This api uses a Mongodb database, so you will need one in order to use it.
First clone the repository
$ git clone https://github.com/khalidM3/GraphTube.git
Install the dependencies and devDependencies and start the server.
$ yarn install
create a .env file and add the following properties
MONGODB_URI='<MONGODB URI>'
$ node start
Now you can make requests to localhost:4000
There are two models in this api
- User
- Video
There are Four graphQL types in this api
- User
- UserInput
- Video
- VideoInput
There are nine queries in total inluding :
-
fetchAllUsers
- this query gets all the users in the database
- type: User
-
fetchUser(id: ID!)
- this query gets a specified user
- type: User
- arguments:
- id : id of the user that is being fetched
-
fetchFollowers(id: ID!)
- this query gets a users followers
- type: User
- arguments:
- id : id of the user
-
fetchFollowing(id: ID!)
- This query fetches a users following
- type: User
- arguments:
- id : id of the user
-
fetchVideo(id: ID!)
- This query fetches a video by its id
- type: Video
- arguments:
- id : id of the video to fetch
-
fetchAllVideo
- This query fetches all the users in the db
- type: Video
-
fetchMyVideos(id: ID!)
- This query fetches all the videos a user posted
- type: Video
- arguments:
- id : id of the user making the request
-
fetchWatchLater: [Video]
- This query fetches all the videos a saved for later
- type: Video
- arguments:
- id : id of the user making request
-
fetchWatchHistory: [Video]
- This query fetches all the videos the user watched
- type: Video
- arguments:
- id : id of the user making the request
There are 12 mutations in this app
-
userAdd(data: UserInput!)
- type: User
- arguments
- data
-
userFollow(id: ID!uid: String!)
- type: User
- arguments:
- id : id of the user that is being followed
- uid: id of the user that is following
-
userUpdate(id: ID!data: UserInput!)
- type: User
- arguments:
- id : id of the user being updated
- data : the updated user
-
userDelete(id: ID!)
- type: User
- arguments:
- id: id of the user being deleted
-
addToWatchLater(id: ID!uid: String!)
- type: User
- arguments:
- id: id of the video to added to watch later
- uid: id of the user who wants to watch later
-
addToWatchHistory(id: ID!uid: String!)
- type: User
- arguments:
- id : id of the video to added to watch history
- uid: the id of user of the history the video is being added to
-
clearWatchHistory(id: ID!uid: String!)
- type: User
- arguments:
- uid : the id of the user whos history is being cleared
-
addVideo(data: VideoInput!)
- type: video
- arguments:
- data : the data of the video
-
likeVideo(id: ID! user: String!)
- type: video
- arguments:
- id : the id of the video to liked
- user : the id of the user making the request
-
dislikeVideo(id: ID!user: String!)
- type: video
- arguments:
- id : the id of the video to disliked
- user : the id of the user making the request
-
updateVideo(id: ID!user: String!data: VideoInput!)
- type: video
- arguments:
- id : the id of the video to update
- user: the id of the user making the request
- data : the updated video
-
deleteVideo(id: ID!uid: String!)
- type: video
- arguments:
- id : the id of the video to delete
- uid : the id of the user making the request