Skip to content

Latest commit

 

History

History
190 lines (133 loc) · 2.63 KB

DOCUMENTATION.md

File metadata and controls

190 lines (133 loc) · 2.63 KB

API Documentation 📝

A guide to consuming this project

Project UML Diagram by Francis Onukwu

This backend project is created to serve an A.P.I using the R.E.S.T protocool. Connected to a database, this service allows clients to make C.R.U.D operations and here's how.


Creating a user


  • Body

 {
    name: <String>
 }

If the name is not already in use, you should get the name and an id as successfull response.

// Example response

{
    name: "John",
    id: "64fe1a06ef2f7757e645289a"
}


Displaying all users

// Example response

{
    "users": [
        {
            "user": "Nat",
            "id": "64fde2f0850aba59ada66e56"
        },
        {
            "user": "John Doee",
            "id": "64fde381f672d85f237222b9"
        },
        {
            "user": "Dammy",
            "id": "64fde438adfb59cb55b5feef"
        },
        {
            name: "John",
            id: "64fe1a06ef2f7757e645289a"
        }
        {
            "user": "Janey",
            "id": "64fe1a06ef2f7757e645289a"
        },
        {
            "user": "Jang",
            "id": "64ff060d6ef23697dbb1513a"
        }
    ]
}


Reading a user

If the id exists, you should get the name and id as successful response.

// Example response

{
    name: "John",
    id: "64fe1a06ef2f7757e645289a"
}


Updating a user


  • Body
{
  newName: <String>
}

If the id exists and the new name isn't taken already, you should get the name and id as successfull response.

 // Example response

{
    name: "Joe",
    id: "64fe1a06ef2f7757e645289a"
}


Deleting a user


If the id exists, you should get a successful response.

// Example response

{
    message: "64fe1a06ef2f7757e645289a has been deleted successfully",
}


Note ‼️

  • All values sent are trimmed.
  • When there is an error, a detailed reason would be sent in the message property of the response object
Example error

{
    message: "No user was found with this name!"
}

Find out how to run this on your machine here