API Routes - RayC206/Rayddit GitHub Wiki
User
Create a user
- Require Authentication: false
- Request
- Method: POST
- URL /api/auth/signup
User login
- Require Authentication: false
- Request
- Method: POST
- /api/auth/login
User logout
- Require Authentication: false
- Request
- Method: POST
- URL : /api/auth/logout
Get details of a user
- Require Authentication: false
- Request
- Method: GET
- URL: /api/users/:userId`
Get all posts authored by a user (Profile)
- Require Authentication: true
- Request
- Method: GET
- URL: /api/users/:userId/posts_by_user
Posts
Create a post
- Require Authentication: True
- Request
- Method: POST
- URL: /api/posts
Edit a post
- Require Authentication: true
- Request
- Method: PUT
- URL: /api/posts/:postId
Delete a post
- Require Authentication: true
- Request
- Method: DELETE
- URL: /api/posts/:postId
Get details of a post
- Require Authentication: false
- Request
- Method: GET
- URL: /api/posts/:postId
Get all posts (All)
- Require Authentication: false
- Request
- Method: GET
- URL: /api/posts/all
Get all posts for the logged in user's subscriptions (Home)
- Require Authentication: true
- Request
- Method: GET
- URL: /api/posts/home
Upvote/Downvote post
- Require Authentication: false
- Request
- Method: POST
- URL: /api/posts/:postId/votes
Get all comments for a post (including replies)
- Require Authentication: false
- Request
- Method: GET
- URL: /api/posts/:postId/comments
Subreddits
Create a subreddit
- Require Authentication: false
- Request
- Method: POST
- URL: /api/subreddits
Edit a subreddit
- Require Authentication: true
- Request
- Method: PUT
- URL: /api/subreddits/:subredditId
Delete a subreddit
- Require Authentication: true
- Request
- Method: DELETE
- URL: /api/subreddits/:subredditId
Get details of a subreddit
- Require Authentication: false
- Request
- Method: GET
- URL: /api/subreddits/:subredditId
Get all posts in a subreddit
- Require Authentication: false
- Request
- Method: GET
- URL: /api/subreddits/:subredditId/posts
Join a subreddit
- Require Authentication: false
- Request
- Method: POST
- URL: /api/subreddits/:subredditId/join
Get all subreddits the logged in user is subscribed to
- Require Authentication: true
- Request
- Method: GET
- URL: /api/subreddits/subscriptions`
Comments
Create a comment
- Require Authentication: True
- Request
- Method: POST
- URL: /api/comments
Edit a comment
- Require Authentication: true
- Request
- Method: PUT
- URL: /api/comments/:commentId
Delete a comment
- Require Authentication: true
- Request
- Method: DELETE
- URL: /api/comments/:commentId
Get details of a comment (including replies)
- Require Authentication: false
- Request
- Method: GET
- URL: /api/comments/:commentId