Skip to content

Latest commit

 

History

History
89 lines (83 loc) · 1.34 KB

DOCS.md

File metadata and controls

89 lines (83 loc) · 1.34 KB

Docs

Users

GET /users

List users

response body:

[{
  "_id": {
    "$oid": "5f9d85c70054627400bed253"
  },
  "name": "Kevin",
  "username": "kevin",
  "password": "123123",
  "email": "kbmelo@outlook.com"
}]

POST /users

Create a new user

request body:

{
  "name": "Kevin",
  "username": "kevin",
  "password": "123123",
  "email": "kbmelo@outlook.com"
}

response body:

{
  "_id": {
    "$oid": "5f9d85c70054627400bed253"
  },
  "name": "Kevin",
  "username": "kevin",
  "password": "123123",
  "email": "kbmelo@outlook.com"
}

PS: username, password and email fields are required, but not sending them should NOT break the application, but return the error in the response.

GET /users/:id

Detail user

response body:

{
  "_id": {
    "$oid": "5f9d85c70054627400bed253"
  },
  "name": "Kevin",
  "username": "kevin",
  "password": "123123",
  "email": "kbmelo@outlook.com"
}

PATCH /users/:username

Update user info

request body:

{
  "name": "Kevin",
  "password": "123123",
}

response body:

{
  "_id": {
    "$oid": "5f9d85c70054627400bed253"
  },
  "name": "Kevin",
  "username": "kevin",
  "password": "123123",
  "email": "kbmelo@outlook.com"
}

DELETE /users/:id

Delete user user

response body:

{
  "message": "Deleted successfully"
}