Friday is a backend project for blog application which uses NodeJS, Express and MongoDB. All extended CRUD capabilities are implemented, mailing and SMS events as well as text search queries and aggregation queries.
- A user is able to register, get a JWT Token, create account, modify user information, specify preferences for contact, indicate interested in topics, and delete the account. The user can reset the password by receiving email.
- A user is able to post a blog, modify the blog content, and add hashtags to blog.
- A user is able to receive recommended blogs for his/her interests.
- A user is able to post a comment, modify the content of a comment, send like to blog and can take back like sent on the blog. If a user liked a blog before, the application warns the user and does now allow the user to move on. Likewise; if a user did not liked a blog before, the user is not able to revert like.
- A user is able to create reading lists with a name that holds other users' blogs.
- When a blog is deleted, the application deletes comments posted on this blog as well. In addition, the deleted blog is removed from the playlists of each user if exists.
- When a user account is deleted, the application clears and removes all necessary information that deleted user is related to. Consequently; comments, blogs and reading lists are removed related to this user.
Use the package manager yarn to install project.
yarn install
Use the package manager yarn to run project.
yarn dev or yarn start
- The rest of the file gives detailed information about endpoints for each service.
Method | Description | Required Body Fields | Authentication |
---|---|---|---|
GET /users | Returns all users documents | required | |
GET /whoami | Returns current session info of user | required | |
POST /users | Returns new created user document | name, email, password |
required |
POST /users/login | Returns logged in user info and authentication token | email, password |
not required |
POST /users/reset-password | Returns information and sends email to user mail | email |
not required |
PATCH /users | Returns updated user information | not required | |
PATCH /users/change-password | Returns information and sends SMS to user phone number | password |
required |
DELETE /users/:userid | Deletes user account and user related data in other collections | required |
Method | Description | Required Body Fields | Authentication |
---|---|---|---|
GET /blogs | Returns all blogs documents | not required | |
GET /blogs/popular-blogs | Returns most liked and published top ten blogs | not required | |
GET /blogs/popular-blogs/:category | Returns most liked and published top five blogs by filter category | not required | |
GET /blogs/search-by-keywords | Returns blogs that contains given words in the body | {keywords: "coffee newyork programming"} |
not required |
GET /blogs/recommend-me | Returns recommended blogs to user by looking users' preferred hashtags and querying these tags for blogs | required | |
GET /blogs/:id | Returns updated user information | required | |
POST /blogs | Returns new created blog document | text, title, category |
required |
PATCH /blogs/:id | Returns updated blog document | required | |
PATCH /blogs/:id/like-flag | Sends like to blog or revert the like, returns updated document | {liked: boolean} |
required |
DELETE /blogs/:id | Deletes the blog by given id and deletes if comments exists for this blog | required |
Method | Description | Required Body Fields | Authentication |
---|---|---|---|
GET /comments | Returns all comments documents | not required | |
GET /comments/:id | Returns single comment by given id | required | |
POST /comments | Returns new created comment document | text |
required |
PATCH /comments/:id | Returns updated comment | text, blog_id |
required |
DELETE /comments/:id | Returns success info and removes comment | required |
Method | Description | Required Body Fields | Authentication |
---|---|---|---|
GET /readinglists | Returns all readinglists documents | required | |
GET /readinglists/:id | Returns single readinglist by given id | required | |
POST /readinglists | Returns new created readinglist | name |
required |
PATCH /readinglists | Returns updated readinglist | required | |
PATCH /:id/add-blog/:blogId | Adds given blog to given reading list and returns updated document | required | |
PATCH /:id/remove-blog/:blogId | Removes given blog from given reading list and returns updated document | required | |
DELETE /readinglists/:id | Removes reading list | required |
- An event is fired when a user changes his/her password. Following this, if user specified to receive SMS on users document preferences then SMS is sent by Twilio services. Make sure that, you have added related information to .env file
- An event is fired when a user resets his/her password.