GithubHelp home page GithubHelp logo

blog-backend-api's Introduction

Blog API Documentation

Technologies Used in the Project

NodeJs, ExpressJS, MongoDB

API Features

  • Authentication & Authorization
  • Post CRUD operations
  • Comment functionality
  • System blocking user if inactive for 30 days
  • A user can block different users
  • A user who block another user cannot see his/her posts
  • Last date a post was created
  • Check if a user is active or not
  • Check last date a user was active
  • Changing user award based on number of posts created by the user
  • A user can follow and unfollow another user
  • Get following and followers count
  • Get total profile viewers count
  • Get posts created count
  • Get count of number of users you blocked
  • Get all users who views someone's profile
  • Admin can block and unblock a user
  • Update password
  • Profile photo upload
  • A user can close his/her account permanently

API Endpoints






Authentication

Welcome to Authentication Section where you can register for a new account and as well as login with your existing account.

The request body needs to be in JSON Format

Register for a new Account

POST /api/v1/users/register

Example Request

{
    "firsname": "your first name",
    "lastname": "your last name",
    "email": "your email address",
    "password": "your password"
}

Login an existing user

POST /api/v1/users/login

Example Request

{
    "email": "your email address",
    "password": "your password"
}

Parameters Required

Parameter Type Description Required
authentication string Your token no
email string Your email yes
password string Your password yes

User

Welcome to the User section where you can perform all the functionalities as an authenticated user.

The request body needs to be in JSON Format

Get all Existing Users

GET /api/v1/users

Parameters Required

Parameter Type Description Required
authentication string Your token yes

View your own Profile

GET /api/v1/users/profile

Parameters Required

Parameter Type Description Required
authentication string Your token yes

Follow a User

GET /api/v1/users/following/:id

Parameters Required

Parameter Type Description Required
authentication string Your token yes
id string ID of the user you want to follow yes

Unfollow a User

GET /api/v1/users/un-follow/:id

Parameters Required

Parameter Type Description Required
authentication string Your token yes
id string ID of the user you want to unfollow yes

Block a User

GET /api/v1/users/blocked/:id

Parameters Required

Parameter Type Description Required
authentication string Your token yes
id string ID of the user you want to block yes

Unblock a User

GET /api/v1/users/un-blocked/:id

Parameters Required

Parameter Type Description Required
authentication string Your token yes
id string ID of the user you want to unblock yes

Update your Profile

PUT /api/v1/users

Example Request

{
    "firsname": "your first name",
    "lastname": "your last name",
    "email": "your email address",
    "password": "your password"
}

Parameters Required

Parameter Type Description Required
authentication string Your token Yes
firstname string Your firstname optional
lastname string Your lastname optional
email string Your email optional
password string Your password optional

View other users

GET /api/v1/users/profile-viewers/:id

Parameters Required

Parameter Type Description Required
authentication string Your token yes
id string ID of the user you want to view his profile yes

Update your password

PUT /api/v1/users/update-password

Example Request

{
    "password": "your password"
}

Parameters Required

Parameter Type Description Required
authentication string Your token yes

Upload profile picture

POST /api/v1/users/profile-photo-upload

Parameters Required

Parameter Type Description Required
authentication string Your token yes
profile string Your profile photo yes

Close your account

DELETE /api/v1/users

Parameters Required

Parameter Type Description Required
authentication string Your token yes

Admin block Account

PUT /api/v1/users/admin-block/:id

Parameters Required

Parameter Type Description Required
authentication string Your token yes
id string ID of the user admin want to block yes

Admin unblock Account

PUT /api/v1/users/admin-unblock/:id

Parameters Required

Parameter Type Description Required
authentication string Your token yes
id string ID of the user admin want to unblock yes

Post

Welcome to the Post section where you can perform all the necessary functions related to Post.

The request body needs to be in Form-Data

Create Post

POST /api/v1/posts

Example Request

{
    "title": "title of the post",
    "description": "description of the post",
    "category": "id of the category you want your post to be the part of",
    "postImage": "upload photo"
}

Parameters Required

Parameter Type Description Required
authentication string Your token yes
title string title of the post yes
description string description of the post yes
category string ID of the category yes
postImage string image of the post yes

Get all Posts

GET /api/v1/posts

Parameters Required

Parameter Type Description Required
authentication string Your token yes

View a Particular Post

GET /api/v1/posts/:id

Parameters Required

Parameter Type Description Required
authentication string Your token yes
id string ID of the post you want to view yes

Toggle like on a Post

GET /api/v1/posts/likes/:id

Parmaeters Required

Parameter Type Description Required
authentication string Your token yes
id string ID of the post you want to like yes

Toggle dislike on a Post

GET /api/v1/posts/dislikes/:id

Parameters Required

Parameter Type Description Required
authentication string Your token yes
id string ID of the post you want to dislike yes

Update your Post

PUT /api/v1/posts/:id

Example Request

{
    "title": "title of the post",
    "description": "description of the post",
    "category": "id of the category you want your post to be the part of",
    "postImage": "upload photo"
}

Parameters Required

Parameter Type Description Required
authentication string Your token yes
id string ID of the post you want to update yes
title string title of the post optional
description string description of the post optional
category string ID of the category optional
postImage string image of the post optional

Delete a Post

DELETE /api/v1/posts/:id

Parameters Required

Parameter Type Description Required
authentication string Your token yes
id string ID of the post you want to delete yes

Cateogory

Welcome to the Cateogry section where you can perform all the necessary functions related to Cateogry.

Create a new Cateogory

POST /api/v1/categories

Example Request

{
    "title": "category title"
}

Parameters Required

Parameter Type Description Required
authentication string Your token yes
title string title of the category yes

Get all Categories

GET /api/v1/categories

Parameters Required

Parameter Type Description Required
authentication string Your token yes

Get a particular Category

GET /api/v1/categories/:id

Parameters Required

Parameter Type Description Required
authentication string Your token yes
id string ID of the category you want to get yes

Update a Category

PUT /api/v1/categories/:id

Example Request

{
    "title": "category title"
}

Parameters Required

Parameter Type Description Required
authentication string Your token yes
id string ID of the category you want to edit yes
title string title of the category yes

Delete a Category

DELETE /api/v1/categories/:id

Parameters Required

Parameter Type Description Required
authentication string Your token yes
id string ID of the category you want to edit yes

Comments

Welcome to the Comments section where you can perform all the functionalities related to comments.

Create a new Comment

POST /api/v1/comments/:id

Example Request

{
    "description": "your comment"
}

Parameters Required

Parameter Type Description Required
authentication string Your token yes

Update a Comment

PUT /api/v1/comments/:id

Example Request

{
    "description": "your comment"
}

Parameters Required

Parameter Type Description Required
authentication string Your token yes
id string id of the comment you want to edit yes
description string description of the comment yes

Delete a Comment

DELETE /api/v1/comments/:id

Parameters Required

Parameter Type Description Required
authentication string Your token yes
id string id of the comment you want to edit yes


Collaboration

If you want to contribute in this project, then, feel free to reach me at [email protected]


Github Repo Link to the Frontend Links Page of the Blog API: https://github.com/somenath203/Blog-API-Links-Frontend

blog-backend-api's People

Contributors

somenath203 avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.