Authorization - Token issued to the current user.
# Successful response
Status: 200 OK
Content-Type: application/json
ResponseBody: {
Returns an array of all contacts
}
Authorization - Token issued to the current user.
id - user contact id.
# Successful response
Status: 200 OK
Content-Type: application/json
ResponseBody: {
Returns an array of all contacts
}
# Unsuccessful response
Status: 404 NotFound
Content-Type: application/json
ResponseBody: {
"message": "Not found"
}
Authorization - Token issued to the current user.
Content-Type: application/json
RequestBody: {
"name": "Test",
"email": "test@mail.com",
"phone": "0505555555"
}
# Successful response
Status: 201 Created
Content-Type: application/json
ResponseBody: {
Returns an array of all contacts
}
# Unsuccessful response
Status: 404 NotFound
Content-Type: application/json
ResponseBody: {
"message": "Not found"
}
Authorization - Token issued to the current user.
id - user contact id.
# Successful response
Status: 200 OK
Content-Type: application/json
ResponseBody: {
"message": "contact deleted"
}
# Unsuccessful response
Status: 404 NotFound
Content-Type: application/json
ResponseBody: {
"message": "Not found"
}
Authorization - Token issued to the current user.
id - user contact id.
Content-Type: application/json
RequestBody: {
"name": "Test",
"email": "test@mail.com",
"phone": "0505555555"
}
# Successful response
Status: 200 OK
Content-Type: application/json
ResponseBody: {
Updated contact object
}
# Unsuccessful response
Status: 400 BadRequest
Content-Type: application/json
ResponseBody: {
"message": "missing fields"
}
Status: 404 NotFound
Content-Type: application/json
ResponseBody: {
"message": "Not found"
}
Authorization - Token issued to the current user.
id - user contact id.
Content-Type: application/json
RequestBody: {
"favorite": true,
}
# Successful response
Status: 200 OK
Content-Type: application/json
ResponseBody: {
"contact deleted"
}
# Unsuccessful response
Status: 400 BadRequest
Content-Type: application/json
ResponseBody: {
"message": "missing fields"
}
Status: 404 NotFound
Content-Type: application/json
ResponseBody: {
"message": "Not found"
}
Content-Type: application/json
RequestBody: {
"email": "example@example.com",
"password": "examplepassword"
}
# Successful response
Status: 201 Created
Content-Type: application/json
ResponseBody: {
"user": {
"email": "example@example.com",
"subscription": "starter"
}
}
# Unsuccessful response
Status: 400 Bad Request
Content-Type: application/json
ResponseBody: <Error from Joi or another validation library>
Status: 409 Conflict
Content-Type: application/json
ResponseBody: {
"message": "Email in use"
}
Content-Type: application/json
RequestBody: {
"email": "example@example.com",
"password": "examplepassword"
}
# Successful response
Status: 200 OK
Content-Type: application/json
ResponseBody: {
"token": "exampletoken",
"user": {
"email": "example@example.com",
"subscription": "starter"
}
}
# Unsuccessful response
Status: 400 Bad Request
Content-Type: application/json
ResponseBody: <Error from Joi or another validation library>
Status: 401 Unauthorized
ResponseBody: {
"message": "Email or password is wrong"
}
Authorization - Token issued to the current user.
# Successful response
Status: 204 No Content
# Unsuccessful response
Status: 401 Unauthorized
Content-Type: application/json
ResponseBody: {
"message": "Not authorized"
}
Authorization - Token issued to the current user.
# Successful response
Status: 200 OK
Content-Type: application/json
ResponseBody: {
"email": "example@example.com",
"subscription": "starter"
}
# Unsuccessful response
Status: 401 Unauthorized
Content-Type: application/json
ResponseBody: {
"message": "Not authorized"
}
Authorization - Token issued to the current user.
Content-Type: application/json
RequestBody: {
"avatarURL": uploaded file
}
# Successful response
Status: 200 OK
Content-Type: application/json
ResponseBody: {
"avatarURL": "here is a link to the image"
}
# Unsuccessful response
Status: 401 Unauthorized
Content-Type: application/json
ResponseBody: {
"message": "Not authorized"
}
verificationToken - Verification token sent by email.
Content-Type: application/json
RequestBody: {
"avatarURL": uploaded file
}
# Successful response
Status: 200 OK
ResponseBody: {
message: 'Verification successful',
}
# Unsuccessful response
Status: 404 Not Found
ResponseBody: {
message: 'User not found'
}
Content-Type: application/json
RequestBody: {
"email": "example@example.com"
}
# Successful response
Status: 200 Ok
Content-Type: application/json
ResponseBody: {
"message": "Verification email sent"
}
# Unsuccessful response
Status: 400 Bad Request
Content-Type: application/json
ResponseBody: <Error from Joi or another validation library>
Status: 400 Bad Request
Content-Type: application/json
ResponseBody: {
message: "Verification has already been passed"
}
npm start— server start in mode productionnpm run start:dev— start server in development mode (development)npm run lint— run code review with eslint, must be done before each PR and fix all linter errorsnpm lint:fix— the same linter check, but with automatic fixes for simple errors