Code Monkey home page Code Monkey logo

back-end-assignment-reunion's Introduction

Project: back-end-assignment-reunion

End-point: New Request

API to create a new user.

required fields:

  • name
  • email
  • id
  • password

Method: POST

127.0.0.1:3000/api/register

Body (raw)

{
    "name": "sudipta pradhan",
    "email": "[email protected]",
    "password": "12345678",
    "id": "sudipta95"
}

⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃

End-point: api/authenticate

Method: POST

127.0.0.1:3000/api/authenticate

Body (raw)

{
    "email": "[email protected]",
    "password": "12345678"
}

Response: 200

{
    "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJfaWQiOiI2NDMzZWE5ZDJmNWZkYTFkODFhY2E1MWYiLCJpYXQiOjE2ODExMzg3ODQsImV4cCI6MTY4MTIyNTE4NH0.37GoOqpKFXbRrq0GYAigklvXyPFkodKAtChGLBlpkzY"
}

⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃

End-point: api/follow/{id}

Method: POST

127.0.0.1:3000/api/follow/test1

Headers

Content-Type Value
token eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJfaWQiOiI2NDM0MjUxZjE0Nzc2ZjQ2MDlkZDdlM2EiLCJpYXQiOjE2ODExMzkwMTIsImV4cCI6MTY4MTIyNTQxMn0.I7SugoTnX_orWymkSqvJk1VZGGpJxVKKCJseeCXgMiI

Response: 200

{
    "message": "Followed successfully"
}

⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃

End-point: api/unfollow/{id}

Method: POST

127.0.0.1:3000/api/unfollow/test1

Headers

Content-Type Value
token eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJfaWQiOiI2NDM0MjUxZjE0Nzc2ZjQ2MDlkZDdlM2EiLCJpYXQiOjE2ODExMzkwMTIsImV4cCI6MTY4MTIyNTQxMn0.I7SugoTnX_orWymkSqvJk1VZGGpJxVKKCJseeCXgMiI

Response: 200

{
    "message": "Unfollowed successfully"
}

⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃

End-point: api/user

Method: GET

127.0.0.1:3000/api/user

Headers

Content-Type Value
token eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJfaWQiOiI2NDM0MjUxZjE0Nzc2ZjQ2MDlkZDdlM2EiLCJpYXQiOjE2ODExMzkwMTIsImV4cCI6MTY4MTIyNTQxMn0.I7SugoTnX_orWymkSqvJk1VZGGpJxVKKCJseeCXgMiI

Query Params

Param value
token eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJfaWQiOiI2NDMzZWE4MDJmNWZkYTFkODFhY2E1MTkiLCJpYXQiOjE2ODExMjQ4NDYsImV4cCI6MTY4MTIxMTI0Nn0._OePoEtfQO-85JZRkr6Sf2b-lEgD38PQn0DhDvZ76_s

Response: 200

{
    "id": "sudipta",
    "email": "[email protected]",
    "followers_count": 0,
    "following_count": 1
}

⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃

End-point: api/posts

Method: POST

127.0.0.1:3000/api/posts

Headers

Content-Type Value
token eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJfaWQiOiI2NDM0MjUxZjE0Nzc2ZjQ2MDlkZDdlM2EiLCJpYXQiOjE2ODExMzkwMTIsImV4cCI6MTY4MTIyNTQxMn0.I7SugoTnX_orWymkSqvJk1VZGGpJxVKKCJseeCXgMiI

Body (raw)

{
    "title": "something",
    "desc": "post description"
}

Response: 201

{
    "message": "Post created successfully",
    "postID": "643424031432893cdf24e817",
    "title": "something",
    "desc": "post description",
    "createdAt": "2023-04-10T14:58:11.801Z"
}

⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃

End-point: api/posts/{id}

Method: DELETE

127.0.0.1:3000/api/posts/643426ab59de48716e27b538

Headers

Content-Type Value
token eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJfaWQiOiI2NDM0MjUxMjE0Nzc2ZjQ2MDlkZDdlMzciLCJpYXQiOjE2ODExMzk0MDYsImV4cCI6MTY4MTIyNTgwNn0.iWVtjoWCkx65TwFJM_0YdXaaJGgwHzQUGHEEdKqaTGw

Headers

Content-Type Value
token eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJfaWQiOiI2NDM0MjUxZjE0Nzc2ZjQ2MDlkZDdlM2EiLCJpYXQiOjE2ODExMzkwMTIsImV4cCI6MTY4MTIyNTQxMn0.I7SugoTnX_orWymkSqvJk1VZGGpJxVKKCJseeCXgMiI

Response: 200

{
    "message": "Post deleted successfully"
}

⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃

End-point: api/like/{id}

Method: POST

127.0.0.1:3000/api/like/643426f259de48716e27b545

Headers

Content-Type Value
token eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJfaWQiOiI2NDM0MjUxMjE0Nzc2ZjQ2MDlkZDdlMzciLCJpYXQiOjE2ODExMzk0MDYsImV4cCI6MTY4MTIyNTgwNn0.iWVtjoWCkx65TwFJM_0YdXaaJGgwHzQUGHEEdKqaTGw

Response: 200

{
    "message": "Post liked successfully"
}

⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃

End-point: api/unlike/{id}

Method: POST

127.0.0.1:3000/api/unlike/643426f259de48716e27b545

Headers

Content-Type Value
token eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJfaWQiOiI2NDM0MjUxZjE0Nzc2ZjQ2MDlkZDdlM2EiLCJpYXQiOjE2ODExMzkwMTIsImV4cCI6MTY4MTIyNTQxMn0.I7SugoTnX_orWymkSqvJk1VZGGpJxVKKCJseeCXgMiI

Headers

Content-Type Value
token eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJfaWQiOiI2NDM0MjUxMjE0Nzc2ZjQ2MDlkZDdlMzciLCJpYXQiOjE2ODExMzk0MDYsImV4cCI6MTY4MTIyNTgwNn0.iWVtjoWCkx65TwFJM_0YdXaaJGgwHzQUGHEEdKqaTGw

Response: 200

{
    "message": "Post disliked successfully"
}

⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃

End-point: api/comment/{id}

Method: POST

127.0.0.1:3000/api/comment/643428775b60f3f79c75bbc1

Headers

Content-Type Value
token eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJfaWQiOiI2NDM0MjUxMjE0Nzc2ZjQ2MDlkZDdlMzciLCJpYXQiOjE2ODExMzk0MDYsImV4cCI6MTY4MTIyNTgwNn0.iWVtjoWCkx65TwFJM_0YdXaaJGgwHzQUGHEEdKqaTGw

Body (raw)

{
    "comment": "nice post"
}

Response: 200

{
    "message": "Comment added Successfully"
}

⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃

End-point: api/posts/{id}

fetch a single post

Method: GET

127.0.0.1:3000/api/posts/643428775b60f3f79c75bbc1

Headers

Content-Type Value
token eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJfaWQiOiI2NDM0MjUxMjE0Nzc2ZjQ2MDlkZDdlMzciLCJpYXQiOjE2ODExMzk0MDYsImV4cCI6MTY4MTIyNTgwNn0.iWVtjoWCkx65TwFJM_0YdXaaJGgwHzQUGHEEdKqaTGw

Response: 200

{
    "post": {
        "_id": "643428775b60f3f79c75bbc1",
        "user": "6434251f14776f4609dd7e3a",
        "title": "something",
        "desc": "post description",
        "likes": [],
        "likesCount": 0,
        "comments": [
            {
                "_id": "643428b4492d136228230d32",
                "user": "6434251214776f4609dd7e37",
                "post": "643428775b60f3f79c75bbc1",
                "comment": "nice post",
                "createdAt": "2023-04-10T15:18:12.570Z",
                "updatedAt": "2023-04-10T15:18:12.570Z",
                "__v": 0
            }
        ],
        "commentCount": 1,
        "createdAt": "2023-04-10T15:17:11.873Z",
        "updatedAt": "2023-04-10T15:18:12.638Z",
        "__v": 1
    }
}

⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃

End-point: api/all_posts

fetch all posts

Method: GET

127.0.0.1:3000/api/all_posts

Response: 200

{
    "posts": [
        {
            "commentCount": 0,
            "_id": "643426f259de48716e27b545",
            "user": "6434251f14776f4609dd7e3a",
            "title": "something",
            "desc": "post description",
            "likes": [
                "6434251214776f4609dd7e37"
            ],
            "likesCount": 1,
            "comments": [],
            "commentsCount": 0,
            "createdAt": "2023-04-10T15:10:42.440Z",
            "updatedAt": "2023-04-10T15:11:35.264Z",
            "__v": 3
        },
        {
            "_id": "643428775b60f3f79c75bbc1",
            "user": "6434251f14776f4609dd7e3a",
            "title": "something",
            "desc": "post description",
            "likes": [],
            "likesCount": 0,
            "comments": [
                {
                    "_id": "643428b4492d136228230d32",
                    "user": "6434251214776f4609dd7e37",
                    "post": "643428775b60f3f79c75bbc1",
                    "comment": "nice post",
                    "createdAt": "2023-04-10T15:18:12.570Z",
                    "updatedAt": "2023-04-10T15:18:12.570Z",
                    "__v": 0
                }
            ],
            "commentCount": 1,
            "createdAt": "2023-04-10T15:17:11.873Z",
            "updatedAt": "2023-04-10T15:18:12.638Z",
            "__v": 1
        }
    ]
}

⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃

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.