GET api/users/me - Get current logged user information.
GET api/users/:id - Get user information by id.
GET api/users/logout - Logout.
Posts 📄
GET api/posts/ - If user is authenticated, get posts from joined communities, else get posts from every community.
GET api/posts/:id - Get post by id.
POST api/posts/ - Add new post.
Example body:
{
"title": "Post title",
"body": "post body should be at least 10 characters long",
"image": "image link",
"postedTo": "60118b873262f7bc6d1d33e0", // target community id"votes": 0
}
Example response:
{
"postedAt": "03-02-2021 7:05",
"_id": "601ac39825644d90b1f23fbd", // post id"title": "Post title",
"body": "post body should be at least 10 characters long",
"image": "image link",
"postedTo": "60118b873262f7bc6d1d33e0", // community id"votes": 0,
"postedBy": "601ac04225644d90b1f23fbc"// user id
}
POST - api/post/:id/action
Example body:
{
"action": "like"// Like Post
}
{
"action": "unlike"// Unlike Post
}
Community 👥
GET /api/community/ - Returns all communities.
GET /api/community/:id - Returns community by given id.