http://localhost:3000
Endpoint: /auth/register
Method: POST
Request Body:
{
"username": "string",
"password": "string"
}
Response:
{
"message": "User registered"
}
cURL Request:
curl -X POST http://localhost:3000/auth/register \
-H "Content-Type: application/json" \
-d '{
"username": "john_doe",
"password": "password123"
}'
Endpoint: /auth/login
Method: POST
Request Body:
{
"username": "string",
"password": "string"
}
Response:
{
"token": "jwt_token"
}
cURL Request:
curl -X POST http://localhost:3000/auth/login \
-H "Content-Type: application/json" \
-d '{
"username": "john_doe",
"password": "password123"
}'
Endpoint: /ratings/rate
Method: POST
Headers:
Authorization: Bearer jwt_token
Content-Type: application/json
Request Body:
{
"rateeId": "string",
"rating": "number",
"feedback": "string"
}
Response:
{
"message": "Rating submitted"
}
cURL Request:
curl -X POST http://localhost:3000/ratings/rate \
-H "Authorization: Bearer jwt_token" \
-H "Content-Type: application/json" \
-d '{
"rateeId": "user_id",
"rating": 4,
"feedback": "Great work!"
}'
Endpoint: /ratings/feedback/:userId
Method: GET
Headers:
Authorization: Bearer jwt_token
Response:
[
{
"rater": {
"_id": "string",
"username": "string"
},
"ratee": "string",
"rating": "number",
"feedback": "string"
}
]
cURL Request:
curl -X GET http://localhost:3000/ratings/feedback/user_id \
-H "Authorization: Bearer jwt_token"
Endpoint: /users/list
Method: GET
Response:
[
{
"_id": "string",
"username": "string",
"averageRating": "number"
}
]
cURL Request:
curl -X GET http://localhost:3000/users/list
Endpoint: /users/profile/:userId
Method: GET
Response:
{
"_id": "string",
"username": "string",
"averageRating": "number"
}
cURL Request:
curl -X GET http://localhost:3000/users/profile/user_id
This documentation should help you interact with your API endpoints effectively. Make sure to replace placeholder values like jwt_token
, user_id
, and others with actual values.