This Reddit Clone has Postgres SQL schema that supports subreddits, posts and comments. Once a user is logged in, he/she can create a subreddit, submit a post and comment on posts. The comments of each posts are rendered recursively to show all replies to a comment.
Our clone also supports upvoting and downvoting of comments.
Created by gh-md-toc
Any request that fails will be given a response as follows:
Response on failure
{
success: false,
error: <String>
}
Example <Post>
{
id: <Number>,
title: <String>,
content: <String>,
createdAt: <Date>,
updatedAt: <Date>,
subredditId: <Number> [may be populated as <Subreddit>],
op: <Number> [may be populated as <User>]
}
(login not required) Response on success
{
success: true,
posts: <Array of Post objects>
}
Example <User>
{
id: <Number>,
username: <String>,
createdAt: <Date>,
updatedAt: <Date>
}
req.body
{
username: <text>,
password: <text>
}
Response on success
{
success: true,
user: <User object (no password)>
}
req.body
{
username: <text>,
password: <text>
}
Response on success
{
success: true,
user: <User object (no password)>
}
Must be logged in to make a new post
req.body
{
title: <String>,
content: <String>,
subredditId: <Number>
}