node.js implementation of a phone book implementing basic crud and using the fs as the storage mechanism.
Base endpoint
/api/v1
- Endpoint:
/contacts/new
- Method:
POST
- Body:
{
"full_name": "John Sunday",
"email": "john@gmail.com",
"username": "johnny",
"phone": "09035958464"
}
- Response:
{
"full_name": "John Sunday",
"username": "johnny",
"email": "john@gmail.com",
"phone": "09035958464",
"id": "563203b7bb21d0de002e4ad94b3e0eb2"
}
Fetches all contacts
- Endpoint:
/contacts/
- Method:
GET
- Response:
[
{
"full_name": "Emmanuel Sunday",
"username": "nuelsoft",
"email": "nuel.mailbox@gmail.com",
"phone": "09035458464",
"id": "91115f67fb3ce4cf7f0b1d996b539bd8"
},
{
"full_name": "John Sunday",
"username": "johnny",
"email": "john@gmail.com",
"phone": "09035958464",
"id": "cf2853c2ce0bbd28eea4e1c6c65f0935"
},
{
"full_name": "Emeka Sunday",
"username": "johnny",
"email": "john@gmail.com",
"phone": "09035958464",
"id": "d338f8ab47f3000879e65733670c7a91"
}
]
- Endpoint:
/contacts/:ID
- Method:
GET
- Sample:
/contacts/cf2853c2ce0bbd28eea4e1c6c65f0935
- Response:
{
"full_name": "John Sunday",
"username": "johnny",
"email": "john@gmail.com",
"phone": "09035958464",
"id": "cf2853c2ce0bbd28eea4e1c6c65f0935"
}
- Endpoint:
/contacts/:ID/update
- Method:
POST
- Body:
{
"full_name": "Michaelson Sunday"
}
- Response:
{
"full_name": "Michaelson Sunday",
"username": "johnny",
"email": "john@gmail.com",
"phone": "09035958464",
"id": "563203b7bb21d0de002e4ad94b3e0eb2"
}
- Endpoint:
/contacts/:ID/remove
- Method:
POST
- Sample:
/contacts/563203b7bb21d0de002e4ad94b3e0eb2/update
- Response:
{
"message": "contact deleted"
}