Open joeljohn159 opened 1 month ago
2. Login a user
Request
curl --request POST \
--url http://localhost:8080/users/login/ \
--header 'Content-Type: application/json' \
--header 'User-Agent: insomnia/2023.5.8' \
--data '{
"email": "random@user.com",
"password": "abcdef"
}'
Response 200
{
"msg": "Login success",
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MSwiZW1haWwiOiJyYW5kb21AdXNlci5jb20iLCJpYXQiOjE3MzA0MTUxNzZ9.KjhUwIH5EJ4CtsNz2aTSjt0HE3qxRdB541tPV9JF9R0",
"data": {
"id": 1,
"email": "random@user.com",
"username": "random user",
"createdAt": "2024-10-31T22:52:29.000Z",
"updatedAt": "2024-10-31T22:52:29.000Z"
}
}
3. Get user data
Request
curl --request GET \
--url http://localhost:8080/users/me/ \
--header 'User-Agent: insomnia/2023.5.8' \
--header 'x-auth-token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MSwiZW1haWwiOiJyYW5kb21AdXNlci5jb20iLCJpYXQiOjE3MzA0MTUxNzZ9.KjhUwIH5EJ4CtsNz2aTSjt0HE3qxRdB541tPV9JF9R0'
Response 200
{
"msg": "SUCCESS",
"data": {
"id": 1,
"username": "random user",
"email": "random@user.com",
"createdAt": "2024-10-31T22:52:29.000Z",
"updatedAt": "2024-10-31T22:52:29.000Z"
}
}
@joeljohn159 @Azeemrm6 Please review and let me know if any update is required.
1. Register a user
Request
Response 201