Skip to content

anukulSingh/mern-social-network

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

All the URL endpoints can be categorized under following:

Endpoints with Authorization header requires users's Sign-in and registration

Any raw data packet received from the client side should be in JSON format

Posts

Indices


1. Add a post

Endpoint:

Method: POST
Type: RAW
URL: http://localhost:5000/api/posts

Headers:

Key Value Description
Authorization eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyIjp7ImlkIjoiNWZiNTM3NTQ2ODY2YTY0MjQwNGFlNzBjIn0sImlhdCI6MTYwODYzODk5MCwiZXhwIjoxNjA4OTk4OTkwfQ.bhgd7Q1dIrrsvIYECTof9I_rkfiSxaT1jK9fr3aDPJk

Body:

{
    "text": "Some content to be posted !"
}

2. Delete a comment

Endpoint:

Method: DELETE
Params: ["postId", "commentId"]
URL:http://localhost:5000/api/posts/comment/5fe1e43f5445ca5c28a440f1/5fe203c3e1524a0cd08d5102

Headers:

Key Value Description
Authorization eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyIjp7ImlkIjoiNWZiNTM3NTQ2ODY2YTY0MjQwNGFlNzBjIn0sImlhdCI6MTYwODYzODk5MCwiZXhwIjoxNjA4OTk4OTkwfQ.bhgd7Q1dIrrsvIYECTof9I_rkfiSxaT1jK9fr3aDPJk

3. Delete a post by id

Endpoint:

Method: DELETE
Params: ["postId]
URL:http://localhost:5000/api/posts/5fe1e9bcf1f917509c9cdbba

Headers:

Key Value Description
Authorization eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyIjp7ImlkIjoiNWZiNTM3NTQ2ODY2YTY0MjQwNGFlNzBjIn0sImlhdCI6MTYwODYzODk5MCwiZXhwIjoxNjA4OTk4OTkwfQ.bhgd7Q1dIrrsvIYECTof9I_rkfiSxaT1jK9fr3aDPJk

4. GET a post by id

Endpoint:

Method: GET
Params: ["postId"]
URL:http://localhost:5000/api/posts/5fe1e43f5445ca5c28a440f1

Headers:

Key Value Description
Authorization eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyIjp7ImlkIjoiNWZiNTM3NTQ2ODY2YTY0MjQwNGFlNzBjIn0sImlhdCI6MTYwODYzODk5MCwiZXhwIjoxNjA4OTk4OTkwfQ.bhgd7Q1dIrrsvIYECTof9I_rkfiSxaT1jK9fr3aDPJk

5. Get all posts

Endpoint:

Method: GET
URL: http://localhost:5000/api/posts

Headers:

Key Value Description
Authorization eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyIjp7ImlkIjoiNWZiNTM3NTQ2ODY2YTY0MjQwNGFlNzBjIn0sImlhdCI6MTYwODYzODk5MCwiZXhwIjoxNjA4OTk4OTkwfQ.bhgd7Q1dIrrsvIYECTof9I_rkfiSxaT1jK9fr3aDPJk

6. Like a post

Endpoint:

Method: PUT
Params: ["postId"]
URL:http://localhost:5000/api/posts/like/5fe1e3975445ca5c28a440f0

Headers:

Key Value Description
Authorization eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyIjp7ImlkIjoiNWZiNTM3NTQ2ODY2YTY0MjQwNGFlNzBjIn0sImlhdCI6MTYwODYzODk5MCwiZXhwIjoxNjA4OTk4OTkwfQ.bhgd7Q1dIrrsvIYECTof9I_rkfiSxaT1jK9fr3aDPJk

7. Comment on a post

Endpoint:

Method: POST
Type: RAW
Params: ["postId"]
URL:http://localhost:5000/api/posts/comment/5fe1e43f5445ca5c28a440f1

Headers:

Key Value Description
Authorization eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyIjp7ImlkIjoiNWZlNDVhMGU0ODE0MTUzMTY0Y2ExYjg3In0sImlhdCI6MTYwODgwMDc4Mn0.D46uiT9KmaHbBebNxnD1-szN8QieCZgcCzhUpz6lF6s

Body:

{
    "text": "some random comment on a post!"
}

8. Unlike a post

Endpoint:

Method: PUT
Params: ["postId"]
URL:http://localhost:5000/api/posts/unlike/5fe1e3975445ca5c28a440f0

Headers:

Key Value Description
Authorization eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyIjp7ImlkIjoiNWZiNTM3NTQ2ODY2YTY0MjQwNGFlNzBjIn0sImlhdCI6MTYwODYzODk5MCwiZXhwIjoxNjA4OTk4OTkwfQ.bhgd7Q1dIrrsvIYECTof9I_rkfiSxaT1jK9fr3aDPJk



Profiles

Indices


1. Get all profiles

Endpoint:

Method: GET
URL: http://localhost:5000/api/profile

2. Get a user's profile by id

Endpoint:

Method: GET
Params: ["userId"]
URL:http://localhost:5000/api/profile/user/5fb537546866a642404ae70c

3. Add profile education

Endpoint:

Method: PUT
Type: RAW
URL: http://localhost:5000/api/profile/education

Headers:

Key Value Description
Authorization eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyIjp7ImlkIjoiNWZiNTM3NTQ2ODY2YTY0MjQwNGFlNzBjIn0sImlhdCI6MTYwNjU3MDYwNiwiZXhwIjoxNjA2OTMwNjA2fQ.Mdk6mB_ySyTOPI77zM382oOO4NSe79PeTEoapbmNNmI

Body:

{
    "school": "Holy test",
    "degree": "Associate degree",
    "fieldofstudy": "Computer science",
    "from": "8-04-2003",
    "to": "9-5-2006",
    "description": "associates in computer science"
}

4. add profile experience

Endpoint:

Method: PUT
Type: RAW
URL: http://localhost:5000/api/profile/experience

Headers:

Key Value Description
Authorization eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyIjp7ImlkIjoiNWZiNTM3NTQ2ODY2YTY0MjQwNGFlNzBjIn0sImlhdCI6MTYwNjU3MDYwNiwiZXhwIjoxNjA2OTMwNjA2fQ.Mdk6mB_ySyTOPI77zM382oOO4NSe79PeTEoapbmNNmI

Body:

{
    "title": "junior dev",
    "company": "ToolSpy",
    "location": "LA",
    "from": "8-04-2014",
    "current": true, (working currently or not)
    "description": "some random stuffs"
}

5. Create/Update profile

Endpoint:

Method: POST
Type: RAW
URL: http://localhost:5000/api/profile

Headers:

Key Value Description
Authorization eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyIjp7ImlkIjoiNWZiNTM3NTQ2ODY2YTY0MjQwNGFlNzBjIn0sImlhdCI6MTYwNTcxMTcwMSwiZXhwIjoxNjA2MDcxNzAxfQ.vkPzkoZx2-iPf-6gBLjOG6mMVqolnzQqxZbOUYzhwY8

Body:

{
    "status": "Instructor",
    "skills": "HTML,CSS, Wordpress,  PHP,python",
    "company": "razorBOx",
    "website": "https://www.jdsingh.com",
    "bio": "I am as instructor",
    "githubusername": "johnDoe",
    "twitter": "some another url",
    "facebook": "some url",
    "youtube": "some url"
}

6. Delete one's account and hence profile

Endpoint:

Method: DELETE
URL: http://localhost:5000/api/profile

Headers:

Key Value Description
Authorization eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyIjp7ImlkIjoiNWZiNTNkYjM1ZTk3MjQzYjA0MmJhMDZkIn0sImlhdCI6MTYwNTcxMzMzMiwiZXhwIjoxNjA2MDczMzMyfQ.1uN0c0BCbP88wLlYn3jNLc71vSVSoN6GUHsHYIJo_g4

7. Delete profile education

Endpoint:

Method: DELETE
Params: ["profileId"]
URL:http://localhost:5000/api/profile/education/5fc25bdf78d34915845e3229

Headers:

Key Value Description
Authorization eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyIjp7ImlkIjoiNWZiNTM3NTQ2ODY2YTY0MjQwNGFlNzBjIn0sImlhdCI6MTYwNjU3MDYwNiwiZXhwIjoxNjA2OTMwNjA2fQ.Mdk6mB_ySyTOPI77zM382oOO4NSe79PeTEoapbmNNmI

8. Delete profile experience

Endpoint:

Method: DELETE
Params: ["profileId"]
URL: http://localhost:5000/api/profile/experience/5fb548000054112ac8dbb411

Headers:

Key Value Description
Authorization eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyIjp7ImlkIjoiNWZiNTM3NTQ2ODY2YTY0MjQwNGFlNzBjIn0sImlhdCI6MTYwNjU3MDYwNiwiZXhwIjoxNjA2OTMwNjA2fQ.Mdk6mB_ySyTOPI77zM382oOO4NSe79PeTEoapbmNNmI

Users and Auth

Indices


1. Get my credentials

Endpoint:

Method: GET
Type: RAW
URL: http://localhost:5000/api/auth

Headers:

Key Value Description
Authorization Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyIjp7ImlkIjoiNWZiM2E2MTVhNmIwNzEwNjkwYTZkYjA3In0sImlhdCI6MTYwNTYwODk4MiwiZXhwIjoxNjA1OTY4OTgyfQ.E6PYsjezSAV0CbCrVXhuQm0oT4XpxNA6RLgv-B6VQz0

Body:

{
    "name": "anukul",
    "email": "anukulsingh125@gmail.com",
    "password": "password"
}

2. Get logged in user's profile

Endpoint:

Method: GET
URL: http://localhost:5000/api/profile/me

Headers:

Key Value Description
Authorization eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyIjp7ImlkIjoiNWY3ZWQxOTliOWNiZDIzMDM0YTRlOWRlIn0sImlhdCI6MTYwMjI0MDU2MCwiZXhwIjoxNjAyNjAwNTYwfQ.q4YKxWCyUHRG_nprvnpmHEJHaCOIRBysMIZwPIMPJyM

3. Login user

Endpoint:

Method: POST
Type: RAW
URL: http://localhost:5000/api/auth

Headers:

Body:

{
    "email": "jdoe125@gmail.com",
    "password": "password"
}

4. Register user

Endpoint:

Method: POST
Type: RAW
URL: http://localhost:5000/api/users

Body:

{
    "name": "anukul kumar",
    "email": "anukulsingh125@gmail.com",
    "password": "password"
}

Releases

No releases published

Packages

No packages published