Skip to content

Latest commit

 

History

History
127 lines (101 loc) · 2.5 KB

File metadata and controls

127 lines (101 loc) · 2.5 KB

@host = http://localhost @port = 5000 @baseUrl = {{host}}:{{port}}

############################# USERS FLOW #################### # 1) Create a new user # Save the returned _id and use it as {{userId}} POST {{baseUrl}}/users/create Content-Type: application/json

{
"name": "Test User", "email": "test@gmail.com", "password": "123456"

}

### # 2) Get all users (Route: /users/all) GET {{baseUrl}}/users/all

### # 3) Get a single user by id (Route: /users/:id) @userId = 69750b1a4eec489f6fa6ede4 GET {{baseUrl}}/users/{{userId}}

### # 4) Update an existing user PUT {{baseUrl}}/users/update Content-Type: application/json

{
"id": "{{userId}}", "name": "Updated Name", "email": "updated@gmail.com"

}

### # 5) Delete a user DELETE {{baseUrl}}/users/delete Content-Type: application/json

{
"id": "{{userId}}"

}

############################# POSTS FLOW #################### # 1) Get all posts (Route: /posts/) GET {{baseUrl}}/posts

### # 2) Get a single post by id (Route: /posts/:id) @postId = 69750b3d4eec489f6fa6edeb GET {{baseUrl}}/posts/{{postId}}

### # 3) Get posts by uploader id (Route: /posts/sender) # Note: Your route is defined as /sender, usually accessed via query params @uploaderId = 696b95a0cd7e9100129c4e4b GET {{baseUrl}}/posts/sender?uploaderId={{uploaderId}}

### # 4) Create a new post POST {{baseUrl}}/posts/create Content-Type: application/json

{
"title": "Post Title Test ", "content": "Post content for API test", "uploader": "{{uploaderId}}"

}

### # 5) Update a post by id (Route: /posts/update/:id) PUT {{baseUrl}}/posts/update/{{postId}} Content-Type: application/json

{
"title": "Post Title Updated", "content": "Updated post content"

}

### # 6) Delete a post DELETE {{baseUrl}}/posts/delete Content-Type: application/json

{
"id": "{{postId}}"

}

############################# COMMENTS FLOW #################### # 1) Get all comments for a specific post (Route: /comments/:postId) @postIdForComments = 69750991bcec10a55719634c GET {{baseUrl}}/comments/{{postIdForComments}}

### # 2) Create a new comment POST {{baseUrl}}/comments/create Content-Type: application/json

{
"userId": "{{userId}}", "postId": "{{postIdForComments}}", "text": "This is a test comment"

}

### # 3) Update a comment by id @commentId = 697509a6bcec10a557196351 PUT {{baseUrl}}/comments/update Content-Type: application/json

{
"id": "{{commentId}}", "text": "Updated comment text"

}

### # 4) Delete a comment by id DELETE {{baseUrl}}/comments/delete Content-Type: application/json

{
"id": "{{commentId}}"

}